networkx

Networkx node traversal

Using Python's Networkx library, I created an undirected graph to represent a relationship network between various people. A snippet of my code is below: import networkx as nx def creategraph(filepath): G=nx.Graph() #All the various nodes and edges are added in this stretch of code. return G From what I understand, eac...

MapReduce, Python and NetworkX

I have implemented an unweighted random walk function for a graph that I built in Python using NetworkX. Below is a snippet of my program that deals with the random walk. Elsewhere in my program, I have a method that creates the graph, and I have a method that simulates various custom graph testing methods that I've written. One of these...

Matrices and inverse Matrices in Python

For a project that I am doing, I decompose a graph that I created using NetworkX into an adjacency matrix using the NetworkX adj_matrix() function. However, one of the problems that I have come across is that every single graph that I decompose gives me the following error when I try to find the inverse of the matrix. str: Traceback (m...

Specified edge lengths on networkx/igraph (Python)

I wanted to visualize a network with the data I have and would like to graph them with specific edge lengths. I use Python, and I've tried networkx and igraph to plot but all seem to assign fixed edge lengths. a.) I wonder if I did the codes wrong or the packages aren't really capable. How do you properly implement specified edge lengt...

Python networkx 2D radial plotting

How do you make a graph in networkx such that its layout is 2D, radial, and the edges are plotted in increasing edge lengths or weights? ...

Python library needed

I am trying to run a python script which has the following statements: import random as RD import pylab as PL import scipy as SP import networkx as NX Where can I download these packages? I have installed these packages and I get the following error when I run my code I am getting the following error when I run the code Traceback (...

Python :How to generate a power law graph

I have installed networkx and matplotlib packages. How can I generate a power law graph based on degree correlation i.e. graphs with high or low degree of homophily ...

How can I convert a digraph to an undirected graph in networkx?

I am using the networkx package. Is there a function in networkx which can do the task for me? ...

Python: Simulate search algorithms in network models

I am using networkx package to draw power law graphs. I want to simulate a search algorithm on this graph and want to visually see the algorithm move from one node to another on the graph. How do I do that? ...

Change the color of a node or an edge

I want to redraw a Graph g with only the color of a node or edge changed. How do I do that? ...

Adding an edge/node with a color attribute

I a using the networkx package of Python. The documentation says we can do H.add_edge(1,2,color='blue') but the output shows an edge with the default(black) color. When I do H.add_node(12,color='green') I get a new node with same default red color. ...

Is there any function that returns the out edges of a node?

I am using python with networkx package. I need to find the nodes connected to out edges of a given node. I know there is a function networkx.DiGraph.out_edges but it returns out edges for the entire graph. ...

Python: How to find if a path exists between 2 nodes in a graph?

I am using networkx package of Python. ...

Change Node Display Size in Networkx

I am not using GraphViz because I am having problems with making it play nice with Networkx. I know this is weird, but I've tried many suggestions to fix this problem, but I just seem to have some of the worst luck in the world. Therefore the problem that I have must be solved withing Networkx without using GraphViz. My program reads a ...

Python networkx DFS or BFS missing?

I am interested in finding a path (not necessarily shortest) in a short amount of time. Dijsktra and AStar in networkx is taking too long. Why is there no DFS or BFS in networkx? I plan to write my own DFS and BFS search (I am leaning more towards BFS because my graph is pretty deep). Is there anything that I can use in networkx's lib...

[python]: path between two nodes

I'm using networkx to work with graphs. I have pretty large graph (it's near 200 nodes in it) and I try to find all possible paths between two nodes. But, as I understand, networkx can find only shortest path. How can I get not just shortest path, but all possible paths? UPD: path can contain each node only once. UPD2: I need something...

Any implementations of graph st-ordering or ear-decomposition?

I'm in the search for an implementation of an ear-decomposition algorithm (http://www.ics.uci.edu/~eppstein/junkyard/euler/ear.html). I examined networkx and didn't find one. Although the algorithm layout is vaguely in my mind, I'd like to see some reference implementation, too. I'm aware of Ulrik Brandes publication on a linear time E...

How do I get nodes from the specific edge in the networkx?

I want to compare nodes of different edges in the graph. How can I get the nodes(n1 and n2) from the edge(n1,n2)? ...

python networkx

hi, i am trying to use networkx with python, when i run this program, it get this error, is there anything missing? #!/usr/bin/env python import networkx as nx import matplotlib import matplotlib.pyplot import matplotlib.pyplot as plt G=nx.Graph() G.add_node(1) G.add_nodes_from([2,3,4,5,6,7,8,9,10]) #nx.draw_graphviz(G) #nx_write_dot...

Method to save networkx graph to json graph?

Seems like there should be a method in networkx to export the json graph format, but I don't see it. I imagine this should be easy to do with nx.to_dict_of_dicts(), but would require a bit of manipulation. Anyone know of a simple and elegant solution? ...