kandi background
Explore Kits

gephi | Gephi The Open Graph Viz Platform

 by   gephi Java Version: v0.9.4 License: Non-SPDX

 by   gephi Java Version: v0.9.4 License: Non-SPDX

Download this library from

kandi X-RAY | gephi Summary

gephi is a Java library typically used in User Interface applications. gephi has no bugs, it has no vulnerabilities, it has build file available and it has high support. However gephi has a Non-SPDX License. You can download it from GitHub, Maven.
Gephi is developed in Java and uses OpenGL for its visualization engine. Built on the top of Netbeans Platform, it follows a loosely-coupled, modular architecture philosophy. Gephi is split into modules, which depend on other modules through well-written APIs. Plugins can reuse existing APIs, create new services and even replace a default implementation with a new one. Consult the Javadoc for an overview of the APIs.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • gephi has a highly active ecosystem.
  • It has 4732 star(s) with 1498 fork(s). There are 257 watchers for this library.
  • There were 2 major release(s) in the last 6 months.
  • There are 444 open issues and 1817 have been closed. On average issues are closed in 308 days. There are 9 open pull requests and 0 closed requests.
  • It has a positive sentiment in the developer community.
  • The latest version of gephi is v0.9.4
gephi Support
Best in #Java
Average in #Java
gephi Support
Best in #Java
Average in #Java

quality kandi Quality

  • gephi has 0 bugs and 0 code smells.
gephi Quality
Best in #Java
Average in #Java
gephi Quality
Best in #Java
Average in #Java

securitySecurity

  • gephi has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • gephi code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
gephi Security
Best in #Java
Average in #Java
gephi Security
Best in #Java
Average in #Java

license License

  • gephi has a Non-SPDX License.
  • Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.
gephi License
Best in #Java
Average in #Java
gephi License
Best in #Java
Average in #Java

buildReuse

  • gephi releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • gephi saves you 121988 person hours of effort in developing the same functionality from scratch.
  • It has 128953 lines of code, 10876 functions and 1353 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
gephi Reuse
Best in #Java
Average in #Java
gephi Reuse
Best in #Java
Average in #Java
Top functions reviewed by kandi - BETA

kandi has reviewed gephi and discovered the below as its top functions. This is intended to give you an instant insight into gephi implemented functionality, and help decide if they suit your requirements.

  • Reads the next token .
  • Draws an image with the sparkline parameters .
  • Performs a vacuate stage .
  • Reads the edge .
  • Auto detect column types .
  • Creates the default node columns .
  • Display the last directory
  • Read a column .
  • Display the graph .
  • Try to guess the character encoding .

gephi Key Features

Gephi - The Open Graph Viz Platform

Checkout and Build the sources

copy iconCopydownload iconDownload
  git clone git@github.com:username/gephi.git

download streets from different address in OSMNX

copy iconCopydownload iconDownload
import osmnx as ox
from osmnx._errors import EmptyOverpassResponse

name_list = ['Kuwait, United Arab Emirates','Guangzhou, China']

for i, file_path in enumerate(name_list):
    print(i)
    CD = file_path
    filtro_vialidades = '["highway"~"trunk|motorwat|primary|secondary|tertiary|residential"]'
    try:
        GCD=ox.graph_from_address(CD, network_type= "drive",
                                  custom_filter= filtro_vialidades)
        ox.save_graphml(GCD, f"{name_list[i]}.graphml", gephi= False)
    except EmptyOverpassResponse:
        print(f"no results: {file_path}")

How to replace strings in text with id from second text?

copy iconCopydownload iconDownload
awk -F, -v OFS=',' 'NR==FNR{a[$2]=$1;next}{$1=a[$1];$2=a[$2]}1' id_file.csv edge_file.csv

How to extract specific items from a nested list and append to new column?

copy iconCopydownload iconDownload
library(purrr)
 mydf$username <- map_depth(mydf$nestedlist, 2, pluck, "username")
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(rrapply)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username', how = 'prune')
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(stringr)
library(dplyr)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username',
          how = 'bind') %>% 
        invoke(str_c, sep=", ", .)
 mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
> str(mydf)
'data.frame':   3 obs. of  4 variables:
 $ Column1   : chr  "A" "B" "C"
 $ column2   : chr  "a" "b" "c"
 $ nestedlist:List of 3
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
 $ username  : chr  "test, test2" "test, test2" "test, test2"
-----------------------
library(purrr)
 mydf$username <- map_depth(mydf$nestedlist, 2, pluck, "username")
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(rrapply)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username', how = 'prune')
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(stringr)
library(dplyr)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username',
          how = 'bind') %>% 
        invoke(str_c, sep=", ", .)
 mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
> str(mydf)
'data.frame':   3 obs. of  4 variables:
 $ Column1   : chr  "A" "B" "C"
 $ column2   : chr  "a" "b" "c"
 $ nestedlist:List of 3
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
 $ username  : chr  "test, test2" "test, test2" "test, test2"
-----------------------
library(purrr)
 mydf$username <- map_depth(mydf$nestedlist, 2, pluck, "username")
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(rrapply)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username', how = 'prune')
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(stringr)
library(dplyr)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username',
          how = 'bind') %>% 
        invoke(str_c, sep=", ", .)
 mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
> str(mydf)
'data.frame':   3 obs. of  4 variables:
 $ Column1   : chr  "A" "B" "C"
 $ column2   : chr  "a" "b" "c"
 $ nestedlist:List of 3
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
 $ username  : chr  "test, test2" "test, test2" "test, test2"
-----------------------
library(purrr)
 mydf$username <- map_depth(mydf$nestedlist, 2, pluck, "username")
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(rrapply)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username', how = 'prune')
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(stringr)
library(dplyr)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username',
          how = 'bind') %>% 
        invoke(str_c, sep=", ", .)
 mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
> str(mydf)
'data.frame':   3 obs. of  4 variables:
 $ Column1   : chr  "A" "B" "C"
 $ column2   : chr  "a" "b" "c"
 $ nestedlist:List of 3
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
 $ username  : chr  "test, test2" "test, test2" "test, test2"
-----------------------
library(purrr)
 mydf$username <- map_depth(mydf$nestedlist, 2, pluck, "username")
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(rrapply)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username', how = 'prune')
> mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
library(stringr)
library(dplyr)
mydf$username <- rrapply(mydf$nestedlist,  
    condition = function(x, .xname) .xname %in% 'username',
          how = 'bind') %>% 
        invoke(str_c, sep=", ", .)
 mydf
  Column1 column2                                                nestedlist    username
1       A       a test, uninteresting content, test2, uninteresting content test, test2
2       B       b test, uninteresting content, test2, uninteresting content test, test2
3       C       c test, uninteresting content, test2, uninteresting content test, test2
> str(mydf)
'data.frame':   3 obs. of  4 variables:
 $ Column1   : chr  "A" "B" "C"
 $ column2   : chr  "a" "b" "c"
 $ nestedlist:List of 3
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  ..$ :List of 2
  .. ..$ 1:List of 2
  .. .. ..$ username          : chr "test"
  .. .. ..$ uninteresting data: chr "uninteresting content"
  .. ..$ 2:List of 2
  .. .. ..$ username          : chr "test2"
  .. .. ..$ uninteresting data: chr "uninteresting content"
 $ username  : chr  "test, test2" "test, test2" "test, test2"

Running Maven for Gephi

copy iconCopydownload iconDownload
<repository>
    <id>netbeans</id>
    <name>NetBeans</name>
    <url>http://bits.netbeans.org/nexus/content/groups/netbeans/</url>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>
<url>http://netbeans.apidesign.org/maven2/</url>
<url>https://netbeans.apidesign.org/maven2/</url>
<dependencies>
    <dependency>
        <groupId>org.gephi</groupId>
        <artifactId>layout-api</artifactId>
        <version>0.9.2</version>
    </dependency>
    <dependency>
        <groupId>org.gephi</groupId>
        <artifactId>graph-api</artifactId>
        <version>0.9.2</version>
    </dependency>
    <!-- ... -->
</dependencies>
-----------------------
<repository>
    <id>netbeans</id>
    <name>NetBeans</name>
    <url>http://bits.netbeans.org/nexus/content/groups/netbeans/</url>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>
<url>http://netbeans.apidesign.org/maven2/</url>
<url>https://netbeans.apidesign.org/maven2/</url>
<dependencies>
    <dependency>
        <groupId>org.gephi</groupId>
        <artifactId>layout-api</artifactId>
        <version>0.9.2</version>
    </dependency>
    <dependency>
        <groupId>org.gephi</groupId>
        <artifactId>graph-api</artifactId>
        <version>0.9.2</version>
    </dependency>
    <!-- ... -->
</dependencies>
-----------------------
<repository>
    <id>netbeans</id>
    <name>NetBeans</name>
    <url>http://bits.netbeans.org/nexus/content/groups/netbeans/</url>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>
<url>http://netbeans.apidesign.org/maven2/</url>
<url>https://netbeans.apidesign.org/maven2/</url>
<dependencies>
    <dependency>
        <groupId>org.gephi</groupId>
        <artifactId>layout-api</artifactId>
        <version>0.9.2</version>
    </dependency>
    <dependency>
        <groupId>org.gephi</groupId>
        <artifactId>graph-api</artifactId>
        <version>0.9.2</version>
    </dependency>
    <!-- ... -->
</dependencies>
-----------------------
<repository>
    <id>netbeans</id>
    <name>NetBeans</name>
    <url>http://bits.netbeans.org/nexus/content/groups/netbeans/</url>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>
<url>http://netbeans.apidesign.org/maven2/</url>
<url>https://netbeans.apidesign.org/maven2/</url>
<dependencies>
    <dependency>
        <groupId>org.gephi</groupId>
        <artifactId>layout-api</artifactId>
        <version>0.9.2</version>
    </dependency>
    <dependency>
        <groupId>org.gephi</groupId>
        <artifactId>graph-api</artifactId>
        <version>0.9.2</version>
    </dependency>
    <!-- ... -->
</dependencies>

How to solve Gephi error : cannot load even default layout (Installation step)

copy iconCopydownload iconDownload
#jdkhome="/path/to/jdk"
jdkhome="C:\Program Files\Java\jre_1.8"
-----------------------
#jdkhome="/path/to/jdk"
jdkhome="C:\Program Files\Java\jre_1.8"

How do you save textnets (python) to gml / gexf or access dataframe of graph?

copy iconCopydownload iconDownload
g = tn.graph
g.write_gml("test.gml")
-----------------------
g = tn.graph
g.write_gml("test.gml")

How can I extract the nodes of the giant component from edges list?

copy iconCopydownload iconDownload
edge_list_df = pd.read_csv('edges.csv')
g =  nx.pandas_edgelist(edge_list_df,source='source',
                        target='target',edge_attr='weight')
component_subgraph_list = list(nx.connected_component_subgraphs(g))
largest_component = max(component_subgraph_list,key=len)
-----------------------
edge_list_df = pd.read_csv('edges.csv')
g =  nx.pandas_edgelist(edge_list_df,source='source',
                        target='target',edge_attr='weight')
component_subgraph_list = list(nx.connected_component_subgraphs(g))
largest_component = max(component_subgraph_list,key=len)

Read Pajek .net files using Graph-tool

copy iconCopydownload iconDownload
import graph_tool.all as gt
import graph_tool.stats as gts

def pajTOgt(filepath, directed = False, removeloops = True):
  if directed:
    g = gt.Graph(directed=True)
  else:
    g = gt.Graph(directed=False)

  #define edge and vertex properties
  g.edge_properties["weight"] = g.new_edge_property("double")
  g.vertex_properties["id"] = g.new_vertex_property("string")

  with open(filepath, encoding = "utf-8") as input_data:
    #create vertices
    for line in input_data:
        g.add_vertex(int(line.replace("*Vertices ", "").strip())) #add vertices
        break

    #label vertices
    for line in input_data: #keeps going for node labels
      if not line.strip() == '*Edges' or line.strip() == '*Arcs':  
        v_id = int(line.split()[0]) - 1
        g.vertex_properties["id"][g.vertex(v_id)] = "".join(line.split()[1:])
      else:
        break

    #create weighted edges
    for line in input_data: #keeps going for edges
      linesplit = line.split()
      linesplit = [int(x) for x in linesplit[:2]] + [float(linesplit[2])]
      if linesplit[2] > 0:
        n1 = g.vertex(linesplit[0]-1)
        n2 = g.vertex(linesplit[1]-1)
        e = g.add_edge(n1, n2)
        g.edge_properties["weight"][e] = linesplit[2]

    if removeloops:
      gts.remove_self_loops(g)

    return g
-----------------------
import re
from io import StringIO

import numpy as np
import pandas as pd

import graph_tool as gt

def pajek_to_gt(path, directed=False, remove_loops=False):
    """
    Load a Pajek .NET file[1] as a graph_tool.Graph.
    Supports files which specify their edges via node pairs.
    Does not support files which specify their edges via the
    'edgeslist' scheme (i.e. the neighbors-list scheme).

    Note:
        Vertices are renumbered to start with 0, per graph-tool
        conventions (not Pajek conventions, which start with 1).

    Author: Stuart Berg (github.com/stuarteberg)
    License: MIT

    [1]: https://gephi.org/users/supported-graph-formats/pajek-net-format/
    """
    # Load into RAM
    with open(path, 'r') as f:
        full_text = f.read()

    if '*edgeslist' in full_text:
        raise RuntimeError("Neighbor list format not supported.")

    # Erase comment lines
    full_text = re.sub(r'^\s*%.*$', '', full_text, flags=re.MULTILINE)

    # Erase blank lines (including those created by erasing comments)
    full_text = re.sub(r'\n+', '\n', full_text)

    # Ensure delimiter is a single space
    full_text = re.sub(r'[ \t]+', ' ', full_text)

    num_vertices = int(StringIO(full_text).readline().split()[-1])

    # Split into vertex section and edges section
    # (Vertex section might be empty)
    vertex_text, edges_text = re.split(r'\*[^\n]+\n', full_text)[1:]

    # Parse vertices (if present)
    v_df = None
    if vertex_text:
        v_df = pd.read_csv(StringIO(vertex_text), delimiter=' ', engine='c', names=['id', 'label'], header=None)
        assert (v_df['id'] == np.arange(1, 1+num_vertices)).all(), \
            "File does not list all vertices, or lists them out of order."

    # Parse edges
    e_df = pd.read_csv(StringIO(edges_text), delimiter=' ', engine='c', header=None)
    if len(e_df.columns) == 2:
        e_df.columns = ['v1', 'v2']
    elif len(e_df.columns) == 3:
        e_df.columns = ['v1', 'v2', 'weight']
    else:
        raise RuntimeError("Can't understand edge list")

    e_df[['v1', 'v2']] -= 1

    # Free up some RAM
    del full_text, vertex_text, edges_text

    # Create graph
    g = gt.Graph(directed=directed)
    g.add_vertex(num_vertices)
    g.add_edge_list(e_df[['v1', 'v2']].values)

    # Add properties
    if 'weight' in e_df.columns:
        g.edge_properties["weight"] = g.new_edge_property("double", e_df['weight'].values)
    if v_df is not None:
        g.vertex_properties["label"] = g.new_vertex_property("string", v_df['label'].values)

    if remove_loops:
      gt.stats.remove_self_loops(g)

    return g
In [1]: from pajek_to_gt import pajek_to_gt

In [2]: g = pajek_to_gt('pajek-example.NET')

In [3]: g.get_vertices()
Out[3]: array([0, 1, 2, 3, 4])

In [4]: g.vertex_properties['label'].get_2d_array([0])
Out[4]: array([['apple', 'cat', 'tree', 'nature', 'fire']], dtype='<U6')

In [5]: g.get_edges()
Out[5]:
array([[0, 2],
       [1, 3]])

In [6]: g.edge_properties['weight'].get_array()
Out[6]: PropertyArray([14.,  1.])
*edgeslist
4941 386 395 451
1 3553 3586 3587 3637
2 3583
3 4930
4 88
5 13 120
-----------------------
import re
from io import StringIO

import numpy as np
import pandas as pd

import graph_tool as gt

def pajek_to_gt(path, directed=False, remove_loops=False):
    """
    Load a Pajek .NET file[1] as a graph_tool.Graph.
    Supports files which specify their edges via node pairs.
    Does not support files which specify their edges via the
    'edgeslist' scheme (i.e. the neighbors-list scheme).

    Note:
        Vertices are renumbered to start with 0, per graph-tool
        conventions (not Pajek conventions, which start with 1).

    Author: Stuart Berg (github.com/stuarteberg)
    License: MIT

    [1]: https://gephi.org/users/supported-graph-formats/pajek-net-format/
    """
    # Load into RAM
    with open(path, 'r') as f:
        full_text = f.read()

    if '*edgeslist' in full_text:
        raise RuntimeError("Neighbor list format not supported.")

    # Erase comment lines
    full_text = re.sub(r'^\s*%.*$', '', full_text, flags=re.MULTILINE)

    # Erase blank lines (including those created by erasing comments)
    full_text = re.sub(r'\n+', '\n', full_text)

    # Ensure delimiter is a single space
    full_text = re.sub(r'[ \t]+', ' ', full_text)

    num_vertices = int(StringIO(full_text).readline().split()[-1])

    # Split into vertex section and edges section
    # (Vertex section might be empty)
    vertex_text, edges_text = re.split(r'\*[^\n]+\n', full_text)[1:]

    # Parse vertices (if present)
    v_df = None
    if vertex_text:
        v_df = pd.read_csv(StringIO(vertex_text), delimiter=' ', engine='c', names=['id', 'label'], header=None)
        assert (v_df['id'] == np.arange(1, 1+num_vertices)).all(), \
            "File does not list all vertices, or lists them out of order."

    # Parse edges
    e_df = pd.read_csv(StringIO(edges_text), delimiter=' ', engine='c', header=None)
    if len(e_df.columns) == 2:
        e_df.columns = ['v1', 'v2']
    elif len(e_df.columns) == 3:
        e_df.columns = ['v1', 'v2', 'weight']
    else:
        raise RuntimeError("Can't understand edge list")

    e_df[['v1', 'v2']] -= 1

    # Free up some RAM
    del full_text, vertex_text, edges_text

    # Create graph
    g = gt.Graph(directed=directed)
    g.add_vertex(num_vertices)
    g.add_edge_list(e_df[['v1', 'v2']].values)

    # Add properties
    if 'weight' in e_df.columns:
        g.edge_properties["weight"] = g.new_edge_property("double", e_df['weight'].values)
    if v_df is not None:
        g.vertex_properties["label"] = g.new_vertex_property("string", v_df['label'].values)

    if remove_loops:
      gt.stats.remove_self_loops(g)

    return g
In [1]: from pajek_to_gt import pajek_to_gt

In [2]: g = pajek_to_gt('pajek-example.NET')

In [3]: g.get_vertices()
Out[3]: array([0, 1, 2, 3, 4])

In [4]: g.vertex_properties['label'].get_2d_array([0])
Out[4]: array([['apple', 'cat', 'tree', 'nature', 'fire']], dtype='<U6')

In [5]: g.get_edges()
Out[5]:
array([[0, 2],
       [1, 3]])

In [6]: g.edge_properties['weight'].get_array()
Out[6]: PropertyArray([14.,  1.])
*edgeslist
4941 386 395 451
1 3553 3586 3587 3637
2 3583
3 4930
4 88
5 13 120
-----------------------
import re
from io import StringIO

import numpy as np
import pandas as pd

import graph_tool as gt

def pajek_to_gt(path, directed=False, remove_loops=False):
    """
    Load a Pajek .NET file[1] as a graph_tool.Graph.
    Supports files which specify their edges via node pairs.
    Does not support files which specify their edges via the
    'edgeslist' scheme (i.e. the neighbors-list scheme).

    Note:
        Vertices are renumbered to start with 0, per graph-tool
        conventions (not Pajek conventions, which start with 1).

    Author: Stuart Berg (github.com/stuarteberg)
    License: MIT

    [1]: https://gephi.org/users/supported-graph-formats/pajek-net-format/
    """
    # Load into RAM
    with open(path, 'r') as f:
        full_text = f.read()

    if '*edgeslist' in full_text:
        raise RuntimeError("Neighbor list format not supported.")

    # Erase comment lines
    full_text = re.sub(r'^\s*%.*$', '', full_text, flags=re.MULTILINE)

    # Erase blank lines (including those created by erasing comments)
    full_text = re.sub(r'\n+', '\n', full_text)

    # Ensure delimiter is a single space
    full_text = re.sub(r'[ \t]+', ' ', full_text)

    num_vertices = int(StringIO(full_text).readline().split()[-1])

    # Split into vertex section and edges section
    # (Vertex section might be empty)
    vertex_text, edges_text = re.split(r'\*[^\n]+\n', full_text)[1:]

    # Parse vertices (if present)
    v_df = None
    if vertex_text:
        v_df = pd.read_csv(StringIO(vertex_text), delimiter=' ', engine='c', names=['id', 'label'], header=None)
        assert (v_df['id'] == np.arange(1, 1+num_vertices)).all(), \
            "File does not list all vertices, or lists them out of order."

    # Parse edges
    e_df = pd.read_csv(StringIO(edges_text), delimiter=' ', engine='c', header=None)
    if len(e_df.columns) == 2:
        e_df.columns = ['v1', 'v2']
    elif len(e_df.columns) == 3:
        e_df.columns = ['v1', 'v2', 'weight']
    else:
        raise RuntimeError("Can't understand edge list")

    e_df[['v1', 'v2']] -= 1

    # Free up some RAM
    del full_text, vertex_text, edges_text

    # Create graph
    g = gt.Graph(directed=directed)
    g.add_vertex(num_vertices)
    g.add_edge_list(e_df[['v1', 'v2']].values)

    # Add properties
    if 'weight' in e_df.columns:
        g.edge_properties["weight"] = g.new_edge_property("double", e_df['weight'].values)
    if v_df is not None:
        g.vertex_properties["label"] = g.new_vertex_property("string", v_df['label'].values)

    if remove_loops:
      gt.stats.remove_self_loops(g)

    return g
In [1]: from pajek_to_gt import pajek_to_gt

In [2]: g = pajek_to_gt('pajek-example.NET')

In [3]: g.get_vertices()
Out[3]: array([0, 1, 2, 3, 4])

In [4]: g.vertex_properties['label'].get_2d_array([0])
Out[4]: array([['apple', 'cat', 'tree', 'nature', 'fire']], dtype='<U6')

In [5]: g.get_edges()
Out[5]:
array([[0, 2],
       [1, 3]])

In [6]: g.edge_properties['weight'].get_array()
Out[6]: PropertyArray([14.,  1.])
*edgeslist
4941 386 395 451
1 3553 3586 3587 3637
2 3583
3 4930
4 88
5 13 120

Store networkx graph with location and weight attributes for Gephi visualization

copy iconCopydownload iconDownload
nx.write_gexf(
G,
path,
encoding='utf-8',
prettyprint=True)

Follow-up to Displaying attributes in Dash/Plotly results in KeyError

copy iconCopydownload iconDownload
G = nx.from_pandas_edgelist(edges, 'Source', 'Target')
nx.set_node_attributes(G, nodes.set_index('Doc')['Description'].to_dict(), 'Description')
nx.set_node_attributes(G, nodes.set_index('Doc')['DocumentID'].to_dict(), 'DocumentID')
str(G.nodes[node]['Description'])
str(G.nodes[node].get('Description', ''))
import networkx as nx
g = nx.karate_club_graph()
# all nodes in this graph have the node attribute 'club' filled
# we add a node without this node attribute
g.add_node("Test")
print(g.nodes[0]["club"])
# 'Mr. Hi'
# print(g.nodes["Test"]["club"]
# results in KeyError: 'club'
print(g.nodes["Test"].get("club", ""))
# ''
-----------------------
G = nx.from_pandas_edgelist(edges, 'Source', 'Target')
nx.set_node_attributes(G, nodes.set_index('Doc')['Description'].to_dict(), 'Description')
nx.set_node_attributes(G, nodes.set_index('Doc')['DocumentID'].to_dict(), 'DocumentID')
str(G.nodes[node]['Description'])
str(G.nodes[node].get('Description', ''))
import networkx as nx
g = nx.karate_club_graph()
# all nodes in this graph have the node attribute 'club' filled
# we add a node without this node attribute
g.add_node("Test")
print(g.nodes[0]["club"])
# 'Mr. Hi'
# print(g.nodes["Test"]["club"]
# results in KeyError: 'club'
print(g.nodes["Test"].get("club", ""))
# ''
-----------------------
G = nx.from_pandas_edgelist(edges, 'Source', 'Target')
nx.set_node_attributes(G, nodes.set_index('Doc')['Description'].to_dict(), 'Description')
nx.set_node_attributes(G, nodes.set_index('Doc')['DocumentID'].to_dict(), 'DocumentID')
str(G.nodes[node]['Description'])
str(G.nodes[node].get('Description', ''))
import networkx as nx
g = nx.karate_club_graph()
# all nodes in this graph have the node attribute 'club' filled
# we add a node without this node attribute
g.add_node("Test")
print(g.nodes[0]["club"])
# 'Mr. Hi'
# print(g.nodes["Test"]["club"]
# results in KeyError: 'club'
print(g.nodes["Test"].get("club", ""))
# ''
-----------------------
G = nx.from_pandas_edgelist(edges, 'Source', 'Target')
nx.set_node_attributes(G, nodes.set_index('Doc')['Description'].to_dict(), 'Description')
nx.set_node_attributes(G, nodes.set_index('Doc')['DocumentID'].to_dict(), 'DocumentID')
str(G.nodes[node]['Description'])
str(G.nodes[node].get('Description', ''))
import networkx as nx
g = nx.karate_club_graph()
# all nodes in this graph have the node attribute 'club' filled
# we add a node without this node attribute
g.add_node("Test")
print(g.nodes[0]["club"])
# 'Mr. Hi'
# print(g.nodes["Test"]["club"]
# results in KeyError: 'club'
print(g.nodes["Test"].get("club", ""))
# ''
-----------------------
G = nx.from_pandas_edgelist(edges, 'Source', 'Target')
nx.set_node_attributes(G, nodes.set_index('Doc')['Description'].to_dict(), 'Description')
nx.set_node_attributes(G, nodes.set_index('Doc')['DocumentID'].to_dict(), 'DocumentID')
str(G.nodes[node]['Description'])
str(G.nodes[node].get('Description', ''))
import networkx as nx
g = nx.karate_club_graph()
# all nodes in this graph have the node attribute 'club' filled
# we add a node without this node attribute
g.add_node("Test")
print(g.nodes[0]["club"])
# 'Mr. Hi'
# print(g.nodes["Test"]["club"]
# results in KeyError: 'club'
print(g.nodes["Test"].get("club", ""))
# ''

Community Discussions

Trending Discussions on gephi
  • download streets from different address in OSMNX
  • How to filter edges by attributes in Gephi?
  • How to replace strings in text with id from second text?
  • Exporting in Gephi doesn't keep labels colors
  • Unable to install igraph due to failing build for the C core
  • How to extract specific items from a nested list and append to new column?
  • Running Maven for Gephi
  • How to solve Gephi error : cannot load even default layout (Installation step)
  • How do you save textnets (python) to gml / gexf or access dataframe of graph?
  • How can I extract the nodes of the giant component from edges list?
Trending Discussions on gephi

QUESTION

download streets from different address in OSMNX

Asked 2022-Mar-24 at 09:03

i would like to download different streets in osmnx, using a list but i can't find the error in my code.

i tried this way

name_list = ['Kuwait, United Arab Emirates','Guangzhou, China']

i=0
for file_path in name_list:
    print(i)
    CD = file_path
    filtro_vialidades = '["highway"~"trunk|motorwat|primary|secondary|tertiary|residential"]'
    GCD=ox.graph_from_address(CD, network_type= "drive",
                              custom_filter= filtro_vialidades)
    ox.save_graphml(GCD, f"{name_list[i]}.graphml", gephi= False)
    i+=1  

#I had this error

EmptyOverpassResponse: There are no data elements in the response JSON

ANSWER

Answered 2022-Mar-23 at 00:11

It looks like it cannot find anything for one of your queries, probably because "Kuwait, United Arab Emirates" does not exist. These are two separate countries.

Source https://stackoverflow.com/questions/71579224

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install gephi

Download and Install Gephi on your computer. Get started with the Quick Start and follow the Tutorials. Load a sample dataset and start to play with the data. If you run into any trouble or have questions consult our forum.
Fork the repository and clone. Run the following command or open the project in an IDE. Once built, one can test running Gephi.
Fork the repository and clone git clone git@github.com:username/gephi.git
Run the following command or open the project in an IDE mvn -T 4 clean install
Once built, one can test running Gephi cd modules/application mvn nbm:cluster-app nbm:run-platform

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.