Is there any way to do the same using only networkx??
Thanks in advance!
--
Salvatore Scellato
Scuola Superiore di Catania
University of Catania
Website: http://www.ssc.unict.it/~sascellato/
No and yes. NetworkX alone doesn't provide any drawing capabilities
but in addition to pygraphviz (for the interface to graphviz)
there is an interface to matplotlib/pylab.
There are some graph layout algorithms built into networkx (they
require the python package numpy).
Alternatively you can write the graph to a file format that is
understood by some other graph drawing software (e.g. dot format).
>>> import networkx
>>> G=networkx.path_graph(4)
>>> pos1=networkx.spring_layout(G) # spring layout - uses numpy
>>> xy=zip(range(4),range(4))
>>> pos2=dict(zip(G.nodes(),xy)) # custom layout
>>> pos3=networkx.graphviz_layout(G) # graphviz layout using 'neato'
>>> networkx.draw(G,pos1) # draw with pylab
>>> import pylab
>>> pylab.show()
Aric
Since I have (x,y) coordinates for each node I guess the best way to
do that is to write the graph to a file and then use something else...
Anyway, probably I will continue using pygraphviz.
Thank you!