2

I am trying to generate a network graph for 200+ nodes and 300+ edges using networkx using python from a file. I was able to generate and plot the graph using matplotlib in my Juypter Notebook, but its not looking good and nodes are so tightly packed.

Is there any other python package help to generate network graph ??.

My aim is to generate graph for whole data set so that I can find dependency between nodes.

3
  • 1
    Can you be more specific on what is "not looking good"? Commented Nov 30, 2017 at 17:40
  • All nodes are closer to each other and generated image is small compared to data set. I am newbie, I hope there is some setting to resolve it Commented Nov 30, 2017 at 17:51
  • networkx is not particularly good at graph visualization (and doesn't aim to be). Check out graphviz: networkx.github.io/documentation/networkx-1.10/reference/… Commented Nov 30, 2017 at 18:02

2 Answers 2

2

If nodes being too close together is the issue, try using the draw_spring()function of networkx. https://networkx.github.io/documentation/networkx-2.0/reference/generated/networkx.drawing.nx_pylab.draw_spring.html#networkx.drawing.nx_pylab.draw_spring

It simulates what would happen if each edge were a spring and the network were picked up and spun around, seperating the nodes, especially the ones which are not connected via many paths.

If this does not work initially, you can use the parameters of the function that draw_spring() wraps, the spring_layout() function. Try adjusting the k value parameter. This should allow you to manipulate the rough distance between nodes. https://networkx.github.io/documentation/networkx-2.0/reference/generated/networkx.drawing.layout.spring_layout.html#networkx.drawing.layout.spring_layout

Alternatively, there are additional draw functions you might find more useful than draw_spring(). You can find them in the draw section here: https://networkx.github.io/documentation/networkx-2.0/reference/drawing.html

Sign up to request clarification or add additional context in comments.

Comments

1

I can recommend using Netwulf. Input a networkx.Graph object to netwulf.visualize, and launch the visualization in a new browser window. The result and data can be posted back to Python.

img

Disclaimer: I co-author Netwulf.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.