27 February 2016

install

  1. install graphviz

         $ brew install graphviz
    
  2. download pygraphviz

  3. edit setup.py

         $ pico setup.py
    
         ...
         include_dirs=['/usr/local/lib/graphviz'],
         library_dirs=['/url/local/include/graphviz'],
         ....
    
  4. install

         $ sudo python setup.py install --include-path=/usr/local/Cellar/graphviz/2.38.0/include --library-path=/usr/local/Cellar/graphviz/2.38.0/lib
    
  5. quick example

         >>> import pygraphviz as pgv
         >>> G=pgv.AGraph()
         >>> G.add_node('a')
         >>> G.add_edge('b','c')
         >>> G
         strict graph {
                 a;
                 b -- c;
         }
    
         # load dot file
         >>> G=pgv.AGraph("file.dot")
    

reference

  1. quick-install

  2. document



blog comments powered by Disqus