Hi,
I am trying to see if graphviz_layout is working fine. I tried
running a given program "atlas.py".
=================================
srivathsan@Adithya:~/python_sims$
srivathsan@Adithya:~/python_sims$ python atlas.py
graph has 779 nodes with 1073 edges
137 connected components
Traceback (most recent call last):
File "atlas.py", line 74, in <module>
pos=nx.graphviz_layout(G,prog="neato")
File "/usr/local/lib/python2.6/dist-packages/networkx/drawing/
nx_agraph.py", line 220, in graphviz_layout
return pygraphviz_layout(G,prog=prog,root=root,args=args)
File "/usr/local/lib/python2.6/dist-packages/networkx/drawing/
nx_agraph.py", line 246, in pygraphviz_layout
A=to_agraph(G)
File "/usr/local/lib/python2.6/dist-packages/networkx/drawing/
nx_agraph.py", line 136, in to_agraph
A=pygraphviz.AGraph(name=N.name,strict=strict,directed=directed)
AttributeError: 'LazyModule' object has no attribute 'AGraph'
srivathsan@Adithya:~/python_sims$
=========================================
srivathsan@Adithya:~$ ipython -pylab
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
Type "copyright", "credits" or "license" for more information.
IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints
more.
Welcome to pylab, a matplotlib-based Python environment.
For more information, type 'help(pylab)'.
In [1]:
In [2]:
In [3]: import networkx as nx
In [4]: import matplotlib.pyplot as plt
In [5]:
In [6]:
In [7]: G=nx.grid_2d_graph(4,4)
In [8]: nx.draw(G)
In [9]: pos=nx.gra
nx.graph nx.graph_number_of_cliques
nx.graph_atlas_g nx.graphml
nx.graph_clique_number nx.graphviz_layout
In [9]: pos=nx.graphviz_layout(G)
---------------------------------------------------------------------------
ImportError Traceback (most recent call
last)
/home/srivathsan/<ipython console> in <module>()
/usr/local/lib/python2.6/dist-packages/networkx/drawing/nx_agraph.pyc
in graphviz_layout(G, prog, root, args)
218
219 """
--> 220 return pygraphviz_layout(G,prog=prog,root=root,args=args)
221
222 def pygraphviz_layout(G,prog='neato',root=None, args=''):
/usr/local/lib/python2.6/dist-packages/networkx/drawing/nx_agraph.pyc
in pygraphviz_layout(G, prog, root, args)
244
245 """
--> 246 A=to_agraph(G)
247 if root is not None:
248 args+="-Groot=%s"%root
/usr/local/lib/python2.6/dist-packages/networkx/drawing/nx_agraph.pyc
in to_agraph(N)
134 directed=N.is_directed()
135 strict=N.number_of_selfloops()==0 and not N.is_multigraph
()
--> 136 A=pygraphviz.AGraph
(name=N.name,strict=strict,directed=directed)
137
138 # default graph attributes
/usr/local/lib/python2.6/dist-packages/networkx/util/imports.pyc in
__getattribute__(self, attr)
210
211 def __getattribute__(self,attr):
--> 212 _loadModule(self)
213 return ModuleType.__getattribute__(self,attr)
214
/usr/local/lib/python2.6/dist-packages/networkx/util/imports.pyc in
_loadModule(module)
189 try:
190 # Get Python (or supplied 'reload') to do the real
import!
--> 191 _loadAndRunHooks(module)
192 except:
193 # Reset our state so that we can retry later
/usr/local/lib/python2.6/dist-packages/networkx/util/imports.pyc in
_loadAndRunHooks(module)
247
248 if module.__dict__.keys()==['__name__']: # don't reload
if already loaded!
--> 249 reload(module)
250
251 try:
/var/lib/python-support/python2.6/pygraphviz/__init__.pyc in <module>
()
34 __license__ = release.license
35
---> 36 from agraph import AGraph, Node, Edge, Attribute,
ItemAttribute
37
38 __all__=[
/var/lib/python-support/python2.6/pygraphviz/agraph.py in <module>()
11 # All rights reserved, see LICENSE for details.
12
---> 13 import graphviz as gv
14 import UserDict
15 import sys
/var/lib/python-support/python2.6/pygraphviz/graphviz.py in <module>()
5 # This file is compatible with both classic and new-style
classes.
6
----> 7 import _graphviz
8 import new
9 new_instancemethod = new.instancemethod
ImportError: libagraph.so.4: cannot open shared object file: No such
file or directory
In [10]:
=================================
When I give the command,
In [11]: pos=nx.graphviz_layout(G, 'neato',None,"")
AttributeError: 'LazyModule' object has no attribute 'AGraph'
=========================
Some libagraph.so file is missing I guess. After installing pygraphviz
and graphviz, i am not sure what more to install. /usr/lib/include
does not have anything in it. Interestingly, /usr/lib/graphviz dir is
present which has the following files :
srivathsan@Adithya:/usr/lib/graphviz$ ls
config6
libgvplugin_gtk.la
libgvplugin_cairo.la libgvplugin_gtk.so
libgvplugin_cairo.so libgvplugin_gtk.so.2
libgvplugin_cairo.so.2 libgvplugin_gtk.so.2.0.0
libgvplugin_cairo.so.2.0.0 libgvplugin_lasi.so
libgvplugin_core.so libgvplugin_lasi.so.6
libgvplugin_core.so.6 libgvplugin_lasi.so.6.0.0
libgvplugin_core.so.6.0.0 libgvplugin_neato_layout.so
libgvplugin_devil.so libgvplugin_neato_layout.so.6
libgvplugin_devil.so.6 libgvplugin_neato_layout.so.6.0.0
libgvplugin_devil.so.6.0.0 libgvplugin_pango.so
libgvplugin_dot_layout.so libgvplugin_pango.so.6
libgvplugin_dot_layout.so.6 libgvplugin_pango.so.6.0.0
libgvplugin_dot_layout.so.6.0.0 libgvplugin_rsvg.so
libgvplugin_gdk_pixbuf.so libgvplugin_rsvg.so.6
libgvplugin_gdk_pixbuf.so.6 libgvplugin_rsvg.so.6.0.0
libgvplugin_gdk_pixbuf.so.6.0.0 libgvplugin_xlib.so
libgvplugin_gd.so libgvplugin_xlib.so.6
libgvplugin_gd.so.6 libgvplugin_xlib.so.6.0.0
libgvplugin_gd.so.6.0.0
srivathsan@Adithya:/usr/lib/graphviz$
==============================
Any ideas how to fix this issue? I would like to see
pos=nx.graphviz_layout working to see the coordinates.
Thanks for your time,
Sri.