Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why networkx.draw() produces nothing? [duplicate]

I'm new to python and I'm using IPython, I'm starting to learn about NetworkX, but just in the starting point now I'm noticing that networkx.draw() is not working, here is my code:

    import networkx as nx
    g = nx.Graph()
    g.add_nodes_from([1,2,3,4])
    nx.draw(g)

but nothing is drawn!

like image 793
Ramin Zahedi Avatar asked Feb 25 '14 19:02

Ramin Zahedi


People also ask

How many nodes can NetworkX handle?

For NetworkX, a graph with more than 100K nodes may be too large. I'll demonstrate that it can handle a network with 187K nodes in this post, but the centrality calculations were prolonged. Luckily, there are some other packages available to help us with even larger graphs.

Is NetworkX scalable?

Due to its dependence on a pure-Python "dictionary of dictionary" data structure, NetworkX is a reasonably efficient, very scalable, highly portable framework for network and social network analysis.

Is NetworkX pure Python?

NetworkX is the only library that is written in pure Python, so it is considerably slower than the rest.


1 Answers

I believe you could show this via PyPlot: http://matplotlib.org/api/pyplot_api.html

NetworkX has some great examples on their website: https://networkx.org/documentation/latest/auto_examples/index.html

A similar question and answer was posted here: Draw graph in NetworkX

like image 108
Michael Burns Avatar answered Oct 03 '22 05:10

Michael Burns