Questions tagged [networkx]

NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks. Use this tag for questions about how to install or use the package, for clarification on any of its methods, or for help with algorithms written with it. Do not use this tag for questions related to troubleshooting computer network connectivity.

Filter by
Sorted by
Tagged with
0 votes
1 answer
33 views

Python - Parent-Child Hierarchy Recursive Structure

I am trying to form a parent to child relationship combination using data available in my pandas dataframe. Data Example: Parent Child A B A C B D B C C D Expected chain results: A|B A|C A|B|D ...
Balaji Srinivasan's user avatar
0 votes
0 answers
16 views

Adding data to Empty Nested Dictionary in Python 3

Am new to Python; trying to learn the concept of dictionary while building / operating a network graph. Looks like I am not getting it right. I have a CSV file of following format: RC11,RC12,RC13,RC14,...
user1931485's user avatar
0 votes
0 answers
20 views

Trying to find python implementation of Force Atlas algorithm [closed]

Im making my fullstack graph visualisation tool with Python backend and i need something better then nx.spring_layout() But there are no lib from net (such as fa2, fa2l, forceatlas2 and others) that ...
nomoredope's user avatar
1 vote
0 answers
28 views

networkx: remove nodes without also removing connected edges

I am using networkx shortest_path function to compute shortest travel distance. However, the size of my G file is close to 15 GB because I use the entire road network for the greater LA area, as ...
Z. G.'s user avatar
  • 27
0 votes
2 answers
57 views

Graph (networkit) - create edges from the record pairs that share the same value in two, or more, of the same columns in pandas

I'm trying to create graph with edges only for nodes/(records index in dataframe) that have the same values in any 2 or more columns. What I'm doing - I create a list with all possible combination ...
Alex_Y's user avatar
  • 592
0 votes
0 answers
14 views

networkx: compute shortest distance from all nodes in a subset to each of the nodes in another subset

I know networkx contains a host of shortest path length algorithms, for example: shortest_path_length. However, all these algorithms pick as argument either the whole set of nodes in a network or ...
user154682's user avatar
0 votes
0 answers
21 views

FancyArrowPatch get the precise position of the endpoint while using NetworkX

I'm trying to replicate this picture using NetworkX and matplotlib I created the network a no problem here graph = nx.Graph() elist = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 0), (5, 1), (5, 2)] ...
Alessandro Romancino's user avatar
0 votes
1 answer
16 views

How to fix API changes in NetworkX?

While doing a Newton-Raphson power flow study, when i run that command: network.pf() I get that error: AttributeError: module 'networkx' has no attribute 'OrderedGraph' **[#5813] OrderedGraph and ...
ILKER DURSUN's user avatar
0 votes
1 answer
38 views

Draw nodes and edges in network [duplicate]

I just wrote python 3.4 code for creating a DAG (Directed Acyclic Graph) graph using Networkx. The problem is that I can't access the dictionary values from within: nx.draw_networkx_nodes(dag, ...
Jatuporn Jirundorn's user avatar
0 votes
0 answers
12 views

Add GeoDataFrame Points to OSMnx graph and connect to closest node

I have a problem that I can't seem to connect my points (bronnen (sources)) from a gdf to a graph that I need for a shortest distance analysis. I want to check the shortest distance from my points to ...
FlorGIS's user avatar
0 votes
0 answers
16 views

Is there a way to display a DiGraph object on a Shiny app?

I'm using Shiny for Python, and it cannot load a graphviz object so I have been trying to find workarounds. I have been trying to convert it to an image, which Shiny can recognize. I am using the ...
feudalcorn's user avatar
1 vote
0 answers
27 views

rendering SVG from segments using networkx is not similar to actual SVG image

I'm trying to render a SVG, it's content is pretty simple: <svg width="3000" height="3000" xmlns="http://www.w3.org/2000/svg"> <path d="...
Maifee Ul Asad's user avatar
0 votes
1 answer
20 views

Error in getting specific node shape, edge color and edge weight

I want to plot a directed graph for a group of genes. Let's say some genes are oncogenes, and some are driver genes. Further, the gene-gene interactions are weighted and represented using specific ...
Lot_to_learn's user avatar
1 vote
0 answers
34 views

Seaching Nodes depending on distance each nodes

I search for Nodes in Shibuya, Tokyo by OSMNX, Python. In my case, I want to find the nodes depending on each distance. I want to search 2 cases, distances between the nodes under 30m and over 100m, ...
Naohiro Miyaguchi's user avatar
0 votes
0 answers
25 views

adding an edge does not change the isochrone in osmnx and networkx

I try to create a new edge for a graph from OpenStreetMap and then perform an isochrone calculation. I first download the graph: import pandas as pd import geopandas as gpd import matplotlib.pyplot as ...
barney stinson 2's user avatar
0 votes
0 answers
12 views

How to count number of connected roads in OSMnx python package

Is it possible to count the number of connected roads (edges) for each road within an OSM network and also delineate by type of road? For example road A is connected to 2 major roads and 3 minor roads....
pip's user avatar
  • 11
-1 votes
0 answers
12 views

connecting two nodes using osmnx overwrites the graph with 0

I have a network graph downloaded with osmnx. I want to connect two nearest nodes and create an edge with this code: import geopandas as gpd import networkx as nx import osmnx as ox point = 45.45272, ...
barney stinson 2's user avatar
0 votes
1 answer
22 views

How to compare the density of two networks with different network sizes

Using networkX (python library), I want to compare the density of two networks with different network sizes. For example, network A has 100 nodes and about 20 edges, while network B has 20 nodes and ...
dhkim's user avatar
  • 1
-1 votes
0 answers
21 views

Reading graph from geodataframe using OSMNX raises an error 'TypeError: cannot unpack non-iterable int object'

I'm trying to read my graph layer from geodataframe to osmnx graph (I manually added one edge in QGIS) import geopandas as gpd import networkx as nx import osmnx as ox highway_new = gpd.read_file(&...
barney stinson 2's user avatar
0 votes
0 answers
14 views

Laplacian centrality in bipartite weighted graphs

I'm new to Network Analysis and I need to solve a doubt: is the Laplacian centrality measure applicable to bipartite graphs? Specifically, I have a bipartite weighted graph. The issue is that I want ...
Salvadana's user avatar
1 vote
0 answers
26 views

Finetuing pyvis to spread node spacing

I'm making a network map of my chess moves in the game played. Here's the code I wrote: N = nx.Graph() N.add_edges_from(main_list) # Calculate node sizes based on their degrees scale = 5 # Scaling ...
Keyser's user avatar
  • 11
1 vote
1 answer
31 views

Temporal topological sort of NetworkX graph

I have a NetworkX graph which was constructed using simple node and edge types, with the addition of a timestamp field on nodes: class Node: key: str timestamp: int class Edge: n1: Node # ...
Lorah Attkins's user avatar
0 votes
1 answer
29 views

Edges removed from osmnx graph still appear when graph is plotted or exported. Why?

I have an osmnx graph. I identified a specific edge that I want to remove from the graph using the G.remove_edge(u, v) function. After doing this, if I run G[u][v] to look at the edge attributes I get ...
Howdy Stargazer's user avatar
0 votes
0 answers
18 views

calculate modularity for each community not communities or whole partitioning?

I'm currently working on a project where I need to calculate the modularity for each community as a quality metric in Python or using NetworkX. I know that NetworkX can calculate modularity for the ...
theking's user avatar
0 votes
0 answers
20 views

Searching the nearest node from the dead-end node on osmnx?

I'm learning how to show the map and show the data from the open street map as osmnx. I wannt to show shortest pass from dead end node to reach the nearest node. I want to this nearest node on the ...
Naohiro Miyaguchi's user avatar
0 votes
0 answers
12 views

Hypothesis testing against LFR benchmark

I have collected data for my project and generated a network out of it. I have done my dose of analysis of the network (power law exponent, nr of communities etc.). I'm wondering whether certain ...
lucyakh's user avatar
-1 votes
2 answers
39 views

How to find the connected components of a networkx graph? (not using the nx.connected_components() command)

I have created an undirected graph using networkx, I need to find a list of all the connected components. connected_components = {} def dfs(node): global connected_components, G if node not ...
luisa's user avatar
  • 3
0 votes
0 answers
24 views

Weighted adjacency list in Python from a graph

I want to create a weighted adjacency list (with weight=length) in Python from a graph that I downloaded. Now, I struggle with creating such a list of the following form: adjacency_list = { 'A': [('C',...
pythagoreansnail's user avatar
0 votes
2 answers
26 views

Connect nearby nodes in geographic graph network

I'm building a graph network of rivers. So far, I've created a networkx graph of lat/lon points on rivers. Each river has edges between it's points. However, no edges exist between different rivers in ...
Luciano's user avatar
  • 426
2 votes
1 answer
82 views

Is finding the largest cycle on a directed graph with 133 Nodes and 737 Edges Computable?

Trying to solve the longest cycle problem for a directed, unweighted graph with 133 nodes and 737 edges. (See also Wikipedia Longest Path Problem). I tried using the networkx library for Python, but ...
Fedaykin1200's user avatar
0 votes
0 answers
101 views

Networkx, lists in python

I am facing issue with lists here. It shows unhashable type: 'list' when i run the code import networkx as nx import itertools as it def brute_communities(G): nodes = G.nodes() n = G....
Andyroid Gaming's user avatar
0 votes
0 answers
16 views

networkx.exception.NetworkXError: Input graph is not chordal

This is my adjacency matrix for a graph G_csp: array([[1., 0., 1., 0., 1., 0., 1., 0., 1., 0., 1., 0.], [0., 1., 0., 1., 0., 1., 0., 1., 0., 1., 0., 1.], [1., 0., 1., 0., 1., 0., 1., 0., ...
user3180's user avatar
  • 1,399
0 votes
0 answers
7 views

can not select the needed value for tau in NetworkX LFR benchmark graph

while creating a LFR benchmark graph from NetworkX library for testing my community detection algorithm, it gives error that the value of tau must be more than 1 but in many community detection ...
EA_Hub's user avatar
  • 30
0 votes
1 answer
30 views

Node and Edge Click Action With NetworkX

I want to create a graph where I want display information based on node and edge click event. I am not able to resolve using Pyvis and NetworkX. Do not see support for click event with Pyvis https://...
Alchemist's user avatar
  • 849
0 votes
0 answers
9 views

How to extract labels from a GML file with networkx?

I am looking to extract all nodes with label as super_technique from my GML file, which looks like this: node [ id 17 label "T1592" name "Gather Victim Host Information&...
Hoang Cuong Nguyen's user avatar
0 votes
0 answers
25 views

How to create graphs for GNN from Voronoi tessellation

I want to do graph regression with GNN. I would like to perform a Voronoi tessellation in cube with 3D coordinates as input, and create a graph in python by connecting the vertices of the Voronoi ...
vis's user avatar
  • 1
0 votes
1 answer
48 views

Creating a graph from research papers

I am working on simple passion project involving graph analytics for research paper. Basically, I want to create a graph structure connecting research papers and eventually would like to analyze how ...
stackword_0's user avatar
0 votes
0 answers
11 views

NetworkX drawn upstream / downstream from a search on Node or Node Attribute?

If you had the following NetworkX graph, how would you add a searchbox so you could type in search criteria "b" or "c" and either "upstream" or "downstream" and ...
Dan's user avatar
  • 121
0 votes
1 answer
20 views

Distance between two bipartite Graphs

I have snapshots of bipartite graphs (50000x70000) that establishes a releationship between a user and artifacts that evolves over time. I am interested in understanding the change point across the ...
Arjit Kapoor's user avatar
0 votes
0 answers
49 views

Power BI - Network graph using NetworkX in Python

I've been exploring NetworkX in PowerBI. If I load the tables; Nodes table NodeName Pathway A A B A\B C A\B\C D A\B\D Edges table From To A\B\C A\B\D A\B\D A\B A\B A Then duplicate the ...
Dan's user avatar
  • 121
0 votes
0 answers
72 views

How can the shape for a node be different from triangle, circle, square at Python?

There is Python code that constructs a simple graph with nodes of different shapes: triangle, circle, square. import networkx as nx G = nx.Graph() G.add_node("circle", shape="o") ...
Imyaf's user avatar
  • 25
1 vote
0 answers
28 views

remove (graph) isomorphic instances from python list

Given a function that returns True if two instances A and B of some class are the "same", is there an efficient way of to remove duplicates from a list? My question is general, but the ...
Bulkilol's user avatar
  • 149
0 votes
1 answer
36 views

Traverse through a networkx graph covering all nodes

I want to traverse through all the nodes in an undirected networkx graph given a start node. The order of nodes visited is not a concern as long as it finds a optimal path with few nodes repeated. ...
RoSy8264's user avatar
0 votes
1 answer
44 views

Wrong colour for nodes when creating network diagram

When creating a network diagram, some of the nodes are displayed with the wrong colours of the categories. I wrote the following code that creates a network diagram. It reads data from two CSV files -...
Alonzo's user avatar
  • 1
0 votes
1 answer
40 views

Generating a configuration model networkx graph from an original graph, but the two have different number of edges

I have a graph G with the following properties {'node_num': 63717, 'edges_num': 373718} and I am trying to generate a configuration model graph as follows with networkx: cm = nx.configuration_model([...
PwNzDust's user avatar
  • 271
0 votes
0 answers
21 views

Can I use the Python package Bokeh to put a network graph from networkx on top of a geographic map?

I know that Bokeh has networkx integration, but I was uncertain if you could then put this network graph on top of a geographic map. The network graph in mind has nodes that are connected by edges, in ...
Daniel Huang's user avatar
0 votes
0 answers
24 views

How to only partially parse a JSON file into NetworkX graph?

I have a JSON with the following format: { "directed": false, "multigraph": false, "nodes": [ { "bad_val": { ... } "id&...
jackhart591's user avatar
0 votes
0 answers
12 views

Find all connected subgraphs of a specified size, not just induced subgraphs, using networkx

The subgraph method offered by python's networkx generates induced (full) subgraph given a subset of vertices. I have been unsuccessful in finding a method for delivering all subgraphs (yes, there ...
Justin Greenough's user avatar
1 vote
1 answer
72 views

Speed up Networkx performance to create management hierarchy

I have a dataset as below: Emp Mgr 0 E1 M1 1 M1 M2 2 M3 M5 3 M2 M5 So for each User(row) I need management hierarchy as: Emp Mgr Level_01 Level_02 Level_03 Level_04 0 E1 M1 M5 ...
priya's user avatar
  • 73
1 vote
1 answer
18 views

NetworkX inconsistent graph membership when using Beautiful Soup Tags as nodes

I'm trying to build a graph of some tags in an HTML document. I'm using NetworkX to construct the graph and since based on the docs, "nodes can be any hashable object" I thought that ...
bphi's user avatar
  • 3,115

1
2 3 4 5
121