Questions tagged [networkx]

NetworkX, developed in Python, is a versatile tool designed for building, modifying, and analyzing complex networks. If you have inquiries on how to install or utilize this package, need clarification on specific methods, or require assistance with algorithms utilizing NetworkX, feel free to use this tag. Please refrain from using this tag for issues concerning computer network connectivity troubleshooting.

Do networkx edges support bidirectional connections?

Are edges created by the networkx Python package bidirectional? For example: graph.add_edge(0,1) This means there is a path from node 0 to 1, but does it also imply a path from 1 to 0? ...

Creating nodes and edges for a graph in Python using data from a CSV file

In my CSV data file, each row represents an event. To illustrate, here is a simplified example: Datetime ColA ColB ColC 2015/07/12 08:45:34 ABC 12 2015/07/12 08:46:04 DCD 10 ABC 2015/07/12 ...

Having trouble rendering anything when visualizing a networkx graph in VTK?

When attempting to run this code, there are no error messages displayed, but only a blank screen appears without any rendering. If you notice any mistakes in the code, please let me know. The node_pos variable is a dictionary containing all node coordinate ...

What is the best way to analyze the similarities and differences between the nodes and edges within two

There are graphs of Berlin from January 1, 2020 and January 1, 2021. How can I compare the changes in edges and nodes between the two maps? import osmnx as ox import pandas as pd import networkx as nx import matplotlib.pyplot as plt from itertools import ...

Using Networkx to Assign Different Colors to Groups of Nodes in a Graph

I'm working on drawing a network where each community is represented by colored nodes (I already have node lists for each community). This is what I currently have: plot = nx.draw(G3, nodecolor='r', node_color= 'white', edge_colo ...

The impact of random attacks on an exponential complex network

I have been attempting to replicate a random attack on an Erdos-Renyi network. The expected outcome is for the network to collapse after removing approximately 20 to 30% of the nodes. However, my results differ as the size of the giant connected component ...

networkx indicates that the random_state_index is not valid

I've been attempting to create a basic graph using networkx and Python. Below is the code I'm using: import networkx as nx import matplotlib.pyplot as plt G = nx.complete_graph(5) nx.draw(G, with_labels=True, font_weight='bold') plt.show() Unfortunately, ...

Top method for creating an edge table from a datamatrix using Python

I have a table T with two columns - 'ID' and 'Genes', which contain lists of genes (Strings). My goal is to generate a graph where each gene is represented as a node, connected by edges to genes that share one different ID. The challenge is that my table r ...

Personalize options for borders and points based on data in a spreadsheet

I have recently constructed a network using NetworkX based on a source-target dataframe: import networkx as nx G = nx.from_pandas_edgelist(df, source='Person1', target='Person2') Here is the dataset I am working with: Person1 Age Per ...

Python Error: Argument count mismatch - 3 expected, but 4 were provided

I am attempting to create a network of cities connected by edges with a dictionary specifying the distance between them. Upon compiling my code, I encountered an error. Can someone assist me in resolving this issue? import networkx as nx cities = nx.Grap ...

Building a Group in Python

Instead of manually creating every edge, is there a more efficient method to form a clique from a list of objects (like strings) that represent vertices? ...

Transforming a pandas dataframe into a networkx graph

I have a dataset structured as follows: A B 0 3 1 1 4 5 2 1 3 3 6 3 4 7 8 I aim to construct an undirected graph using networkx where each entry in the dataset represents a node in the graph (with the index value serving as the node l ...

Leveraging networkX for generating a hierarchical tree diagram

Currently, I am utilizing networkX to create a tree structure, following the guidance provided in this insightful response. import networkx as nx import matplotlib.pyplot as plt G = nx.DiGraph() G.add_node("ROOT") for i in range(5): G.add_node("Child ...

I'm having trouble retrieving the IP address of a specific website URL using networkx and requests. Why could this be happening?

I have been working on a project to map website urls to their corresponding IP addresses and visualize the data using networkx. Utilizing BeautifulSoup, my code scans a webpage for links and then follows those links. I encountered difficulty in directly as ...