Coder Social home page Coder Social logo

pygraphviz / pygraphviz Goto Github PK

View Code? Open in Web Editor NEW
738.0 36.0 205.0 5.01 MB

Python interface to Graphviz graph drawing package

Home Page: https://pygraphviz.github.io/

License: Other

Makefile 0.13% Python 38.25% C 58.62% SWIG 3.00%
graph-visualization complex-networks python spec-0

pygraphviz's Introduction

PyGraphviz

image

image

PyGraphviz is a Python interface to the Graphviz graph layout and visualization package. With PyGraphviz you can create, edit, read, write, and draw graphs using Python to access the Graphviz graph data structure and layout algorithms. PyGraphviz provides a similar programming interface to NetworkX (https://networkx.org).

Simple example

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

Install

PyGraphviz requires Graphviz. Please see INSTALL.txt for details.

License

Released under the 3-Clause BSD license (see LICENSE):

Copyright (C) 2006-2024 PyGraphviz Developers
Aric Hagberg <[email protected]>
Dan Schult <[email protected]>
Manos Renieris

pygraphviz's People

Contributors

0xflotus avatar adarshp avatar andriyor avatar arne-cl avatar cristifati avatar dabreese00 avatar dependabot[bot] avatar dschult avatar elishapiiro avatar hagberg avatar jamadden avatar jarrodmillman avatar javiolonchelo avatar jck avatar jeanclaude-jardim-oxb avatar jlec avatar jonathanslenders avatar kagami avatar krassowski avatar mgorny avatar mindw avatar mmarkov avatar mriduls avatar nehaljwani avatar nightvision04 avatar rossbar avatar sindrehan avatar stephengroat avatar waynr avatar woodruffw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pygraphviz's Issues

Installation:fatal error: 'graphviz/cgraph.h' file not found

I use Windoews 7 OS
and python 3.4.2
I run the code:
python setup.py install

But it cause the error:
D:\pygraphviz-master>python setup.py install
library_dirs=None
include_dirs=None
running install
running bdist_egg
running egg_info
writing top-level names to pygraphviz.egg-info\top_level.txt
writing dependency_links to pygraphviz.egg-info\dependency_links.txt
writing pygraphviz.egg-info\PKG-INFO
reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '~' found anywhere in distributi
on
warning: no previously-included files matching '
.pyc' found anywhere in distrib
ution
warning: no previously-included files matching '.svn' found anywhere in distribu
tion
no previously-included directories found matching 'doc\build'
writing manifest file 'pygraphviz.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
D:\mingw-get\bin\gcc.exe -mdll -O -Wall -DGVDLL -ID:\Python34\include -ID:\Pytho
n34\include -c pygraphviz/graphviz_wrap.c -o build\temp.win32-3.4\Release\pygrap
hviz\graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2954:29: fatal error: graphviz/cgraph.h: No such file
or directory
#include "graphviz/cgraph.h"
^
compilation terminated.
error: command 'D:\mingw-get\bin\gcc.exe' failed with exit status 1

xlabel doesn't support html

Would be nice to make this:

graph.get_node('A').attr["xlabel"] = '<<font color="purple">A</font>>'

being handled in same way as "label" to result in following dot:

A [xlabel=<<font color="purple">A</font>>];

instead of escaped:

A [xlabel="<<font color=\"purple\">A</font>>"];

If not familiar with feature, take a look here: http://www.graphviz.org/content/node-shapes#html

Cannot install pygraphviz

OSError: Error locating graphviz.

Try to redownload graphviz and requirement is already satisfied.

Using Jupyter.

Typo in the doc

Hi,

One can find:

string()
Return a string (unicode) represetnation of graph in dot format.

Cheers.

function Graph.clear() always crashes with a SIGSEGV on Debian 8

Hi,
I have the version 1.3~rc2-1 installed on my Debian 8.

I report the fact that on more or less each execution of a Graph.clear() the program return a SIGSEGV status.

The same code executed successfully on 20 different PC with an Ubuntu-like distribution but me with Debian.

Once removed the code lines where the function is called, everything seems to work well.

I don't know if my distribution is the source of the problem, but I don't have any corrupted package and python codes run well in all other tasks.

Hope this is a good issue report and I am not wasting your time.

Franciskittu

pip install with --install-option

It would be great if it was possible to install pygraphviz via pip and pass library_path and include_path arguments eg

pip install pygraphviz --install-option="--library_path=/my/lib/path" --install-option="--include_path=/my/include/path"

get_node() can't find nodes specified via html labels, also edges() result is incorrect

Given a standard example from the graphviz documentation for HTML style tags...

digraph structs {
    node [shape=plaintext]
    struct1 [label=< <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD>left</TD><TD PORT="f1">mid dle</TD><TD PORT="f2">right</TD></TR> </TABLE>>];
    struct2 [label=< <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> <TR><TD PORT="f0">one</TD><TD>two</TD></TR> </TABLE>>];
    struct3 [label=< <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4"> <TR> <TD ROWSPAN="3">hello<BR/>world</TD> <TD COLSPAN="3">b</TD> <TD ROWSPAN="3">g</TD> <TD ROWSPAN="3">h</TD> </TR> <TR> <TD>c</TD><TD PORT="here">d</TD><TD>e</TD> </TR> <TR> <TD COLSPAN="3">f</TD> </TR> </TABLE>>];
    struct1:f1 -> struct2:f0;
    struct1:f2 -> struct3:here;
}

I load the file, and try to extract a node like "struct1:f1", i.e., a node that exists because it is a port on an HTML label.

>>> import pygraphviz
>>> G = pygraphviz.AGraph("junk.dot"
>>> G.get_node("struct1")
u'struct1'
>>> G.get_node("struct1:f1")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/pygraphviz/agraph.py", line 424, in get_node
    return Node(self, n)
  File "/usr/lib64/python2.7/site-packages/pygraphviz/agraph.py", line 1568, in __new__
    raise KeyError("Node %s not in graph." % n)
KeyError: u'Node struct1:f1 not in graph.'
>>> G.nodes()
[u'struct1', u'struct2', u'struct3']
>>> G.edges()
[(u'struct1', u'struct2'), (u'struct1', u'struct3')]

Note that the nodes are incomplete and the edges are incorrect as they do not take the ports into account.

G.draw() still draws the correct graph.

AGraph.add_node with arbitrary node attributes

Since n is an argument name of add_node it can not be used as a keyword argument leading to an exception being thrown.

G = nx.Graph()
G.add_node(1, attr_dict={'n' : 10})
nx.to_agraph(G)

TypeError: add_node() got multiple values for argument 'n'

see networkx/networkx#1582 and networkx/networkx#1583.

Changing the signature to add_node(self, n, attr_dict=None, **attr) would allow for a similar behavior as in networkx.

Given a design decision I would be willing to contribute the necessary changes.

Is ranking for a set of nodes implemented?

Hi

I looked in the doc trying to get something like in p16 of the http://graphviz.org/pdf/dotguide.pdf, i.e., getting the line
{ rank = same; "past"; "SCCS"; "make"; "Bourne sh"; "yacc"; "cron"; }

It's not clear for me how I can write that kind of thing using the API.
I'm currently trying to use an additional node, with style='invis' and using something like rank="same; node1; node2;"...

Is there a simpler mean?
Thank you.

Python 3 support

Are there any plans to add the Python 3 support to Pygraphviz?

I looked through the sources, and besides minor fixes (parentheses for print calls, one change in raise call, a few bytes to str transformations, some imports needs to be changed from relative to absolute), there seems to be the only problem I'm not sure how to approach: PyFile_AsFile used in the SWIG-generated interface is not present in the Python 3 API anymore, so some workaround needs to be added.

Python 3 support

Currently, pygraphviz doesn't support Python 3. Is it planned to change ?

add_subgraph still broken in 1.3rc2

The behavior of add_subgraph still is not where it's supposed to be:

In [1]: import networkx as nx

In [2]: G = nx.MultiDiGraph()

In [3]: G.add_edge(1, 2, key="ab", myattr="55")

In [4]: A = nx.to_agraph(G)

In [5]: print A
digraph {
1 -> 2 [key=ab,
myattr=55];
}

In [6]: A.add_subgraph([1, 2], name="sg" )
Out[6]: <AGraph sg <Swig Object of type 'Agraph_t *' at 0x10e4e5690>>

In [7]: print A
digraph {
subgraph sg {
1 -> 2;
}
1 -> 2 [key=ab,
myattr=55];
}

Edges again gets duplicated and lose attributes as it was before.

escaping bug: " after \ isn't correctly escaped...

i have a node label containing \" (so a literal \ followed by a ") (don't ask me why, it's real world data :-/ ...)

In [1]: from pygraphviz import *

In [2]: g = AGraph()

In [3]: g.add_edge('foo', '"bar\\"bar"')

In [4]: g.to_string()
Out[4]: u'strict graph  {\n\tfoo -- "\\"bar\\\\"bar\\"";\n}\n'

In [5]: print g.to_string()
strict graph  {
    foo -- "\"bar\\"bar\"";
}

In 5 you can see that the \ is correctly escaped for dot, but the following " isn't and will end the node label causing the parsers to fail.

Warning, error, or feasibility of setting attr of a node after an add_edge()

Hi,

In the following code, using an add_node( 1, label='...') won't work if made after an add_egde() including it. One must use the get_node() and set the attribute in such a case.
Would it be possible to have an error, or at least a warning, if we try to change something that won't be considered when written to file? -- or my preferred, that the addition would be made, since the node does not even appear except for the link...

Cheers.

.Y

#!/usr/bin/python
import sys
from pygraphviz import *
import os
import pdb # Debug purpose
#    pdb.set_trace()

input="bug"

G=AGraph(directed=True,strict=False,label=input,rankdir="TB", ranksep='1.0 equally', compound='true')
G.node_attr['shape']="circle"
G.node_attr['fontsize']=24

g=G.add_subgraph( None,"cluster"+str(0),label='Proc'+str(0) )
g.add_edge( 1, 2 )
g.add_edge( 2, 3 )
#g.add_node( 1, label="S1" )
n=g.get_node(1)
n.attr['label']="S1"

G.add_node( "G1" )
G.add_node( "G2" )
G.add_edge( "G1", "G2" )

G.write(input+".dot")
G.draw(input+".pdf", prog='dot')

Error when using pygraphviz within gevents environment

When executing with patched subprocess file handles as stdin come in as FileObjectPosix wrapped around a SocketAdapter when calling layout().
These kind of file object are correctly writable and readable, but agwrite throws an error saying it's not a file handle. It seems to almost be a python problem because you're using PyFile_Check but I am looking for a workaround. Not sure exactly why layout needs to read stdin even though it has no input file.

Still getting the linking error in #16 in the release version (1.3.1)

Hi there - I'm still getting the linking error in #16 trying to build using WinPython w/ python 3.4.3 and Visual Studio 10. Suggestions?

Most relevant bit:

graphviz_wrap.obj : error LNK2019: unresolved external symbol _PyIOBase_Type ref
erenced in function __wrap_agread
include_dirs=C:\Program Files (x86)\Graphviz2.38\include
library_dirs=C:\Program Files (x86)\Graphviz2.38\lib\debug\lib
running build
running build_py
running egg_info
writing dependency_links to pygraphviz.egg-info\dependency_links.txt
writing pygraphviz.egg-info\PKG-INFO
writing top-level names to pygraphviz.egg-info\top_level.txt
reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc\build'
writing manifest file 'pygraphviz.egg-info\SOURCES.txt'
running build_ext
building 'pygraphviz._graphviz' extension
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox
 /MD /W3 /GS- /DNDEBUG "-IC:\Program Files (x86)\Graphviz2.38\include" -IC:\winp
y\python-3.4.3\include -IC:\winpy\python-3.4.3\include /Tcpygraphviz/graphviz_wr
ap.c /Fobuild\temp.win32-3.4\Release\pygraphviz/graphviz_wrap.obj
graphviz_wrap.c
pygraphviz/graphviz_wrap.c(3321) : warning C4047: 'return' : 'int' differs in le
vels of indirection from 'Agsym_t *'
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo
 /INCREMENTAL:NO "/LIBPATH:C:\Program Files (x86)\Graphviz2.38\lib\debug\lib" /L
IBPATH:C:\winpy\python-3.4.3\libs /LIBPATH:C:\winpy\python-3.4.3\PCbuild cgraph.
lib cdt.lib /EXPORT:PyInit__graphviz build\temp.win32-3.4\Release\pygraphviz/gra
phviz_wrap.obj /OUT:build\lib.win32-3.4\pygraphviz\_graphviz.pyd /IMPLIB:build\t
emp.win32-3.4\Release\pygraphviz\_graphviz.lib /MANIFESTFILE:build\temp.win32-3.
4\Release\pygraphviz\_graphviz.pyd.manifest
   Creating library build\temp.win32-3.4\Release\pygraphviz\_graphviz.lib and ob
ject build\temp.win32-3.4\Release\pygraphviz\_graphviz.exp
graphviz_wrap.obj : error LNK2019: unresolved external symbol _PyIOBase_Type ref
erenced in function __wrap_agread
build\lib.win32-3.4\pygraphviz\_graphviz.pyd : fatal error LNK1120: 1 unresolved
 externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\
link.exe' failed with exit status 1120

1.3 release

How about releasing the new version to have distros use the py3 support.

pygraphviz cannot be installed with pip

% 1 python3 --version;pip --version;pip install pygraphviz
Python 3.3.5
pip 1.5.4 from /home/users/mkaysi/.pyenv/versions/3.3.5/lib/python3.3/site-packages/pip-1.5.4-py3.3.egg (python 3.3)
Downloading/unpacking pygraphviz
  Downloading pygraphviz-1.2.tar.gz (90kB): 90kB downloaded
  Running setup.py (path:/tmp/pip_build_mkaysi/pygraphviz/setup.py) egg_info for package pygraphviz
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_mkaysi/pygraphviz/setup.py", line 23
        print "To install, run 'python setup.py install'"
                                                        ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_mkaysi/pygraphviz/setup.py", line 23

    print "To install, run 'python setup.py install'"

                                                    ^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_mkaysi/pygraphviz
Storing debug log for failure in /home/users/mkaysi/.pip/pip.log
------------------------------------------------------------
/home/users/mkaysi/.pyenv/versions/3.3.5/bin/pip run on Mon May 26 19:59:10 2014
Downloading/unpacking pygraphviz
  Getting page https://pypi.python.org/simple/pygraphviz/
  URLs to search for versions for pygraphviz:
  * https://pypi.python.org/simple/pygraphviz/
  Analyzing links from page https://pypi.python.org/simple/pygraphviz/
    Skipping link https://pypi.python.org/packages/2.4/p/pygraphviz/pygraphviz-0.99-py2.4-linux-i686.egg#md5=82581a5e6021989c904fed1ee742cd99 (from https://pypi.python.org/simple/pygraphviz/); unknown archive format: .egg
    Skipping link https://pypi.python.org/packages/2.4/p/pygraphviz/pygraphviz-0.99.1-py2.4-linux-i686.egg#md5=b9c89f19746e57cfab51ab281381a609 (from https://pypi.python.org/simple/pygraphviz/); unknown archive format: .egg
    Skipping link https://pypi.python.org/packages/2.5/p/pygraphviz/pygraphviz-0.99-py2.5-linux-i686.egg#md5=359c0c5bee29cf7365707ff536ab6892 (from https://pypi.python.org/simple/pygraphviz/); unknown archive format: .egg
    Skipping link https://pypi.python.org/packages/2.5/p/pygraphviz/pygraphviz-0.99.1-py2.5-linux-i686.egg#md5=b440a72ab04a80eb48dd09aed2121bf5 (from https://pypi.python.org/simple/pygraphviz/); unknown archive format: .egg
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.34.tar.gz#md5=550b94a2cbb1827af1a23d87c4e04810 (from https://pypi.python.org/simple/pygraphviz/), version: 0.34
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.34.zip#md5=775cec62c3da868553f0a7b89ec1dcc2 (from https://pypi.python.org/simple/pygraphviz/), version: 0.34
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.35.tar.gz#md5=28bf924a706e073fc9861f0beeb0b9aa (from https://pypi.python.org/simple/pygraphviz/), version: 0.35
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.35.zip#md5=fa41fbca0edeccf6ec044294dab4c7ca (from https://pypi.python.org/simple/pygraphviz/), version: 0.35
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.36.tar.gz#md5=13c32c59933dfc3de3edd092b5b3b08c (from https://pypi.python.org/simple/pygraphviz/), version: 0.36
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.36.zip#md5=2ad831f8014d782fee23f650aa0cd535 (from https://pypi.python.org/simple/pygraphviz/), version: 0.36
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.37.tar.gz#md5=3379f23497bffe549269cfcf00de099b (from https://pypi.python.org/simple/pygraphviz/), version: 0.37
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.37.zip#md5=0f935a2517341e27886e21216525a9cd (from https://pypi.python.org/simple/pygraphviz/), version: 0.37
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.99.1.tar.gz#md5=5381633f9538804b24046eb96474668d (from https://pypi.python.org/simple/pygraphviz/), version: 0.99.1
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.99.1.zip#md5=33a9d11592a10dd0e9de6d587db5b101 (from https://pypi.python.org/simple/pygraphviz/), version: 0.99.1
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.99.tar.gz#md5=b0052a2b1d3a9cfb806eb8b28abf8e2d (from https://pypi.python.org/simple/pygraphviz/), version: 0.99
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-0.99.zip#md5=1625afb50d6d2d4dd833ee2f9810bcd0 (from https://pypi.python.org/simple/pygraphviz/), version: 0.99
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0.tar.gz#md5=f0cb263f4f56a0ba5c10e3ddcbbdf314 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0.zip#md5=52e0b79451e031e9cb7ee3b05f75f227 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc1.tar.gz#md5=6ec2327bd60d5f045195c5b60ccb269e (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc1
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc1.zip#md5=c226038dd78d59af3519d281eb4fd7a8 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc1
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc2.tar.gz#md5=b7b728837da91be1d07d6670225a95e7 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc2
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc2.zip#md5=f2c3ea804fffe4c902c92753238931a5 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc2
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc3.tar.gz#md5=fbe24ba9e3cf8fc9705e7acbc582f63d (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc3
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc3.zip#md5=1aab6d8e039041655e6bdd0789fb2313 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc3
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc4.tar.gz#md5=9d2d2e04e86bde7699db22cd19758424 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc4
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc4.zip#md5=669ece9e6cc2eed1826b61eee854cb28 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc4
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc5.tar.gz#md5=5853cde70a1a26a3b1922ce90759f5d7 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc5
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc5.zip#md5=908f0127a72c441faa650f6f9d7cdb17 (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc5
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc6.tar.gz#md5=a8bafcfbd1b4c039dd116d53871e5fcc (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc6
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc6.zip#md5=0d7b2e76d6914b0e3e58d6a99933919a (from https://pypi.python.org/simple/pygraphviz/), version: 1.0rc6
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.1.tar.gz#md5=5c206838ce81180557e29135e93b2461 (from https://pypi.python.org/simple/pygraphviz/), version: 1.1
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.1.zip#md5=9b9958f10bdf29c06d9f43e225f6ac0c (from https://pypi.python.org/simple/pygraphviz/), version: 1.1
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.1rc1.tar.gz#md5=7e709a8bf8d5103b461a5f54a399ef0d (from https://pypi.python.org/simple/pygraphviz/), version: 1.1rc1
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.1rc1.zip#md5=cb5b015ad61eb200ab40003481f620e2 (from https://pypi.python.org/simple/pygraphviz/), version: 1.1rc1
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.2.tar.gz#md5=dbe3fa55e59a5d7e3bd924511b3275c4 (from https://pypi.python.org/simple/pygraphviz/), version: 1.2
    Found link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.2.zip#md5=90c728a8db276eede4e3af2f990a8985 (from https://pypi.python.org/simple/pygraphviz/), version: 1.2
    Skipping link http://networkx.github.io (from https://pypi.python.org/simple/pygraphviz/); not a file
    Skipping link http://networkx.lanl.gov/download (from https://pypi.python.org/simple/pygraphviz/); not a file
    Skipping link http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/); not a file
    Skipping link http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/); not a file
    Skipping link http://networkx.lanl.gov/pygraphviz/ (from https://pypi.python.org/simple/pygraphviz/); not a file
    Skipping link http://networkx.lanl.gov/wiki/download (from https://pypi.python.org/simple/pygraphviz/); not a file
    Skipping link http://pygraphviz.github.io (from https://pypi.python.org/simple/pygraphviz/); not a file
    Skipping link http://sourceforge.net/project/showfiles.php?group_id=122233&package_id=161979 (from https://pypi.python.org/simple/pygraphviz/); unknown archive format: .php
    Skipping link https://pypi.python.org/pypi/pygraphviz (from https://pypi.python.org/simple/pygraphviz/); not a file
  Not searching http://networkx.lanl.gov/download (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/download/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz/ (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz/ (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz/ (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz/ (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/pygraphviz/ (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/wiki/download (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/wiki/download (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/wiki/download (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/wiki/download (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://networkx.lanl.gov/wiki/download (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://pygraphviz.github.io (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://sourceforge.net/project/showfiles.php?group_id=122233&package_id=161979 (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://sourceforge.net/project/showfiles.php?group_id=122233&package_id=161979 (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://sourceforge.net/project/showfiles.php?group_id=122233&package_id=161979 (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://sourceforge.net/project/showfiles.php?group_id=122233&package_id=161979 (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching http://sourceforge.net/project/showfiles.php?group_id=122233&package_id=161979 (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Not searching https://pypi.python.org/pypi/pygraphviz (from https://pypi.python.org/simple/pygraphviz/) for files because external urls are disallowed.
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc1.tar.gz#md5=6ec2327bd60d5f045195c5b60ccb269e (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc1 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc1.zip#md5=c226038dd78d59af3519d281eb4fd7a8 (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc1 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc2.tar.gz#md5=b7b728837da91be1d07d6670225a95e7 (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc2 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc2.zip#md5=f2c3ea804fffe4c902c92753238931a5 (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc2 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc3.tar.gz#md5=fbe24ba9e3cf8fc9705e7acbc582f63d (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc3 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc3.zip#md5=1aab6d8e039041655e6bdd0789fb2313 (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc3 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc4.tar.gz#md5=9d2d2e04e86bde7699db22cd19758424 (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc4 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc4.zip#md5=669ece9e6cc2eed1826b61eee854cb28 (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc4 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc5.tar.gz#md5=5853cde70a1a26a3b1922ce90759f5d7 (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc5 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc5.zip#md5=908f0127a72c441faa650f6f9d7cdb17 (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc5 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc6.tar.gz#md5=a8bafcfbd1b4c039dd116d53871e5fcc (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc6 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.0rc6.zip#md5=0d7b2e76d6914b0e3e58d6a99933919a (from https://pypi.python.org/simple/pygraphviz/), version 1.0rc6 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.1rc1.tar.gz#md5=7e709a8bf8d5103b461a5f54a399ef0d (from https://pypi.python.org/simple/pygraphviz/), version 1.1rc1 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.1rc1.zip#md5=cb5b015ad61eb200ab40003481f620e2 (from https://pypi.python.org/simple/pygraphviz/), version 1.1rc1 is a pre-release (use --pre to allow).
  Using version 1.2 (newest of versions: 1.2, 1.2, 1.1, 1.1, 1.0, 1.0, 0.99.1, 0.99.1, 0.99, 0.99, 0.37, 0.37, 0.36, 0.36, 0.35, 0.35, 0.34, 0.34)
  Downloading from URL https://pypi.python.org/packages/source/p/pygraphviz/pygraphviz-1.2.tar.gz#md5=dbe3fa55e59a5d7e3bd924511b3275c4 (from https://pypi.python.org/simple/pygraphviz/)
  Running setup.py (path:/tmp/pip_build_mkaysi/pygraphviz/setup.py) egg_info for package pygraphviz
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_mkaysi/pygraphviz/setup.py", line 23
        print "To install, run 'python setup.py install'"
                                                        ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_mkaysi/pygraphviz/setup.py", line 23

    print "To install, run 'python setup.py install'"

                                                    ^

SyntaxError: invalid syntax

----------------------------------------
Cleaning up...
  Removing temporary dir /tmp/pip_build_mkaysi...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_mkaysi/pygraphviz
Exception information:
Traceback (most recent call last):
  File "/home/users/mkaysi/.pyenv/versions/3.3.5/lib/python3.3/site-packages/pip-1.5.4-py3.3.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/home/users/mkaysi/.pyenv/versions/3.3.5/lib/python3.3/site-packages/pip-1.5.4-py3.3.egg/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/home/users/mkaysi/.pyenv/versions/3.3.5/lib/python3.3/site-packages/pip-1.5.4-py3.3.egg/pip/req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "/home/users/mkaysi/.pyenv/versions/3.3.5/lib/python3.3/site-packages/pip-1.5.4-py3.3.egg/pip/req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/home/users/mkaysi/.pyenv/versions/3.3.5/lib/python3.3/site-packages/pip-1.5.4-py3.3.egg/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_mkaysi/pygraphviz

Import error on Ubuntu 15.04

I've installed pygraphviz 1.3.1 with pip on Ubuntu 15.04, and when I try to import I get the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-99ed911275c0> in <module>()
----> 1 import pygraphviz

/home/greff/venv/py2/local/lib/python2.7/site-packages/pygraphviz/__init__.py in <module>()
     56 __license__  = release.license
     57 
---> 58 from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError
     59 
     60 __all__=[

/home/greff/venv/py2/local/lib/python2.7/site-packages/pygraphviz/agraph.py in <module>()
     24     from collections import MutableMapping as DictMixin
     25 
---> 26 from . import graphviz as gv
     27 
     28 _DEFAULT_ENCODING = 'UTF-8'

/home/greff/venv/py2/local/lib/python2.7/site-packages/pygraphviz/graphviz.py in <module>()
     26                 fp.close()
     27             return _mod
---> 28     _graphviz = swig_import_helper()
     29     del swig_import_helper
     30 else:

/home/greff/venv/py2/local/lib/python2.7/site-packages/pygraphviz/graphviz.py in swig_import_helper()
     22         if fp is not None:
     23             try:
---> 24                 _mod = imp.load_module('_graphviz', fp, pathname, description)
     25             finally:
     26                 fp.close()

ImportError: /home/greff/venv/py2/local/lib/python2.7/site-packages/pygraphviz/_graphviz.so: undefined symbol: Agundirected

Any ideas?

Installation:fatal error: 'graphviz/cgraph.h' file not found

I use mac os
I run the code:

python setup.py install 

But it didn't success
So I write the dirs:

include_dirs = "/Users/allenlee/Downloads/pygraphviz-master/pygraphviz"
library_dirs = "/Users/allenlee/Downloads/pygraphviz-master/pygraphviz"

But it cause the error

AllendeMacBook-Pro:pygraphviz-master allenlee$ python setup.py install
library_dirs=/Users/allenlee/Downloads/pygraphviz-master/pygraphviz
include_dirs=/Users/allenlee/Downloads/pygraphviz-master/pygraphviz
running install
running build
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/allenlee/Downloads/pygraphviz-master/pygraphviz -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.6-intel-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2969:10: fatal error: 'graphviz/cgraph.h' file not found
#include "graphviz/cgraph.h"
         ^

Could you help to solve it?Thanks a lot

graphviz_wrap.obj : error LNK2019: unresolved external symbols on Windows

The build under Windows is now finding graphviz2.38 for header files and lib files following the addition of lines in setup.py

# Windows
# Unknown - use command line -I and -L switches to set
library_dirs='C:/Program Files (x86)/Graphviz2.38/lib/release/lib'
include_dirs='C:/Program Files (x86)/Graphviz2.38/include'

but still has some unresolved symbols during the link step, see below

$ python setup.py install
library_dirs=C:/Program Files (x86)/Graphviz2.38/lib/release/lib
include_dirs=C:/Program Files (x86)/Graphviz2.38/include
running install
running bdist_egg
running egg_info
writing pygraphviz.egg-info\PKG-INFO
writing top-level names to pygraphviz.egg-info\top_level.txt
writing dependency_links to pygraphviz.egg-info\dependency_links.txt
reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc\build'
writing manifest file 'pygraphviz.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building 'pygraphviz._graphviz' extension
C:\Users\GJWood\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD
 /W3 /GS- /DNDEBUG -DGVDLL "-IC:/Program Files (x86)/Graphviz2.38/include" -Ic:\Users\GJWood\Anaconda\include -Ic:\Users
\GJWood\Anaconda\PC /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-2.7\Release\pygraphviz/graphviz_wrap.obj
graphviz_wrap.c
pygraphviz/graphviz_wrap.c(3295) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
pygraphviz/graphviz_wrap.c(3313) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
pygraphviz/graphviz_wrap.c(3321) : warning C4047: 'return' : 'int' differs in levels of indirection from 'Agsym_t *'
pygraphviz/graphviz_wrap.c(3407) : warning C4101: 'mode_byte_obj1' : unreferenced local variable
pygraphviz/graphviz_wrap.c(3406) : warning C4101: 'mode_obj1' : unreferenced local variable
pygraphviz/graphviz_wrap.c(3408) : warning C4101: 'mode1' : unreferenced local variable
pygraphviz/graphviz_wrap.c(3405) : warning C4101: 'fd1' : unreferenced local variable
pygraphviz/graphviz_wrap.c(3466) : warning C4101: 'mode2' : unreferenced local variable
pygraphviz/graphviz_wrap.c(3464) : warning C4101: 'mode_obj2' : unreferenced local variable
pygraphviz/graphviz_wrap.c(3463) : warning C4101: 'fd2' : unreferenced local variable
pygraphviz/graphviz_wrap.c(3465) : warning C4101: 'mode_byte_obj2' : unreferenced local variable
C:\Users\GJWood\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /IN
CREMENTAL:NO "/LIBPATH:C:/Program Files (x86)/Graphviz2.38/lib/release/lib" /LIBPATH:c:\Users\GJWood\Anaconda\libs /LIBP
ATH:c:\Users\GJWood\Anaconda\PCbuild\amd64 cgraph.lib cdt.lib /EXPORT:init_graphviz build\temp.win-amd64-2.7\Release\pyg
raphviz/graphviz_wrap.obj /OUT:build\lib.win-amd64-2.7\pygraphviz\_graphviz.pyd /IMPLIB:build\temp.win-amd64-2.7\Release
\pygraphviz\_graphviz.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\pygraphviz\_graphviz.pyd.manifest
graphviz_wrap.obj : warning LNK4197: export 'init_graphviz' specified multiple times; using first specification
   Creating library build\temp.win-amd64-2.7\Release\pygraphviz\_graphviz.lib and object build\temp.win-amd64-2.7\Releas
e\pygraphviz\_graphviz.exp
graphviz_wrap.obj : error LNK2019: unresolved external symbol agsafeset referenced in function agsafeset_label
graphviz_wrap.obj : error LNK2019: unresolved external symbol agstrdup_html referenced in function agsafeset_label
graphviz_wrap.obj : error LNK2019: unresolved external symbol agattr referenced in function agattr_label
graphviz_wrap.obj : error LNK2019: unresolved external symbol agopen referenced in function _wrap_agopen
graphviz_wrap.obj : error LNK2019: unresolved external symbol agclose referenced in function _wrap_agclose
graphviz_wrap.obj : error LNK2019: unresolved external symbol agread referenced in function _wrap_agread
graphviz_wrap.obj : error LNK2019: unresolved external symbol agwrite referenced in function _wrap_agwrite
graphviz_wrap.obj : error LNK2019: unresolved external symbol agisundirected referenced in function _wrap_agisundirected

graphviz_wrap.obj : error LNK2019: unresolved external symbol agisdirected referenced in function _wrap_agisdirected
graphviz_wrap.obj : error LNK2019: unresolved external symbol agisstrict referenced in function _wrap_agisstrict
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnode referenced in function _wrap_agnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agidnode referenced in function _wrap_agidnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agsubnode referenced in function _wrap_agsubnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstnode referenced in function _wrap_agfstnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtnode referenced in function _wrap_agnxtnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol aglstnode referenced in function _wrap_aglstnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agprvnode referenced in function _wrap_agprvnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agedge referenced in function _wrap_agedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agidedge referenced in function _wrap_agidedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agsubedge referenced in function _wrap_agsubedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstin referenced in function _wrap_agfstin
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtin referenced in function _wrap_agnxtin
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstout referenced in function _wrap_agfstout
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtout referenced in function _wrap_agnxtout
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstedge referenced in function _wrap_agfstedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtedge referenced in function _wrap_agnxtedge
graphviz_wrap.obj : error LNK2019: unresolved external symbol agattrsym referenced in function _wrap_agattrsym
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtattr referenced in function _wrap_agnxtattr
graphviz_wrap.obj : error LNK2019: unresolved external symbol agget referenced in function _wrap_agget
graphviz_wrap.obj : error LNK2019: unresolved external symbol agxget referenced in function _wrap_agxget
graphviz_wrap.obj : error LNK2019: unresolved external symbol agset referenced in function _wrap_agset
graphviz_wrap.obj : error LNK2019: unresolved external symbol agxset referenced in function _wrap_agxset
graphviz_wrap.obj : error LNK2019: unresolved external symbol agsubg referenced in function _wrap_agsubg
graphviz_wrap.obj : error LNK2019: unresolved external symbol agfstsubg referenced in function _wrap_agfstsubg
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnxtsubg referenced in function _wrap_agnxtsubg
graphviz_wrap.obj : error LNK2019: unresolved external symbol agparent referenced in function _wrap_agparent
graphviz_wrap.obj : error LNK2019: unresolved external symbol agroot referenced in function _wrap_agroot
graphviz_wrap.obj : error LNK2019: unresolved external symbol agdelsubg referenced in function _wrap_agdelsubg
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnnodes referenced in function _wrap_agnnodes
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnedges referenced in function _wrap_agnedges
graphviz_wrap.obj : error LNK2019: unresolved external symbol agdegree referenced in function _wrap_agdegree
graphviz_wrap.obj : error LNK2019: unresolved external symbol agraphof referenced in function _wrap_agraphof
graphviz_wrap.obj : error LNK2019: unresolved external symbol agnameof referenced in function _wrap_agnameof
graphviz_wrap.obj : error LNK2019: unresolved external symbol agdelnode referenced in function _wrap_agdelnode
graphviz_wrap.obj : error LNK2019: unresolved external symbol agdeledge referenced in function _wrap_agdeledge
graphviz_wrap.obj : error LNK2019: unresolved external symbol Agdirected referenced in function Swig_var_Agdirected_get
graphviz_wrap.obj : error LNK2019: unresolved external symbol Agstrictdirected referenced in function Swig_var_Agstrictd
irected_get
graphviz_wrap.obj : error LNK2019: unresolved external symbol Agundirected referenced in function Swig_var_Agundirected_
get
graphviz_wrap.obj : error LNK2019: unresolved external symbol Agstrictundirected referenced in function Swig_var_Agstric
tundirected_get
build\lib.win-amd64-2.7\pygraphviz\_graphviz.pyd : fatal error LNK1120: 49 unresolved externals
error: command 'C:\\Users\\GJWood\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd
64\\link.exe' failed with exit status 1120

pip can not install pygraphviz on win32 ?Do you Have the exe install packages???I'm going crazy

..............
C:\Program Files\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.ex
e /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /T
cpygraphviz/graphviz_wrap.c /Fobuild\temp.win32-2.7\Release\pygraphviz/graphviz_
wrap.obj
graphviz_wrap.c
pygraphviz/graphviz_wrap.c(2954) : fatal error C1083: Cannot open include file
: 'graphviz/cgraph.h': No such file or directory
error: command '"C:\Program Files\Common Files\Microsoft\Visual C++ for Python
\9.0\VC\Bin\cl.exe"' failed with exit status 2

Throw exceptions instead of logging

I'm building interactive dot visualizer (for my modeling labs). On every keystroke pygraphviz reads text edit and constructs a graph. The problem is that if the user made a mistake I have no ways to check this and skip graph rendering. It would be better if AGraph raised an exception with the same message as it logs now. In this case I could easily catch it, show it to user and skip rendering.

PS: Thanks for your library. It's very easy to use.

nbunch in function edges() doesn't work properly

In the AGraph class, the function edges() has a parameter nbunch to limit edges to the ones that include nodes in the sequence.
For example:

>>> import pygraphviz
>>> import pygraphviz as pgv
>>> a = pgv.AGraph()
>>> a.add_edge('a', 'e')
>>> a.add_edge('b', 'e')
>>> a.add_edge('c', 'e')
>>> a.add_edge('d', 'e')
>>> a.edges('a')
[(u'a', u'e')]
>>> a.edges('e')
[]

unable to set border style on subgraph

import pygraphviz as pgv

A=pgv.AGraph()
# add some edges
A.add_edge(1,2)
A.add_edge(2,3)
A.add_edge(1,3)
A.add_edge(3,4)
A.add_edge(3,5)
A.add_edge(3,6)
A.add_edge(4,6)
# make a subgraph with rank='same'
B=A.add_subgraph([4,5,6],name='s1',rank='same', color='blue')
B.graph_attr['rank']='same'
B.graph_attr['color'] = 'red'
A.layout(prog='dot')
print A

produces this output on my machine:

strict graph {
graph [bb="0,0,198,252"];
node [label="\N"];
subgraph s1 {
    graph [color=red,
        rank=same
    ];
    4        [height=0.5,
        pos="27,18",
        width=0.75];
    6        [height=0.5,
        pos="99,18",
        width=0.75];
    4 -- 6       [pos="54,18 59.977,18 65.953,18 71.93,18"];
    5        [height=0.5,
        pos="171,18",
        width=0.75];
}
1    [height=0.5,
    pos="99,234",
    width=0.75];
2    [height=0.5,
    pos="72,162",
    width=0.75];
1 -- 2   [pos="92.601,216.41 88.36,205.41 82.811,191.03 78.54,179.96"];
3    [height=0.5,
    pos="99,90",
    width=0.75];
1 -- 3   [pos="102.65,215.91 104.68,205.57 106.98,192.09 108,180 109.34,164.06 109.34,159.94 108,144 106.98,131.91 104.68,118.43 102.65,108.09"];
2 -- 3   [pos="78.399,144.41 82.64,133.41 88.189,119.03 92.46,107.96"];
3 -- 4   [pos="84.43,74.834 72.02,62.77 54.269,45.512 41.796,33.385"];
3 -- 6   [pos="99,71.697 99,60.846 99,46.917 99,36.104"];
3 -- 5   [pos="113.57,74.834 125.98,62.77 143.73,45.512 156.2,33.385"];
}

rank=same is in the graph subattribute of the subgraph s1, and so is color=red. However, graphviz wants the color attribute to be at the top level of the subraph, like so:

subgraph s1 {
    color=red

}

It happens to work for rank, but fails for color.

Unable to Execute Graphviz Script in Spyder

I am unable to execute a Graphviz test script in Spyder (which is based on Python 2.7.9). The Script and the Test Result are attached. The test result shows Pygraphviz is required.

I attempted to install Pygraphviz using pip but that failed because Graphviz could not be found, but Graphviz appears to be installed in /Library/Python/2.7/site-packages. The install attempt and the contents of the /Library/Python/2.7/site-packages directory are also attached.

I am probably not installing Pygraphviz correctly and/or Graphviz is not installed correctly. I would really appreciate any help to overcome this problem.

screen shot 2015-04-28 at 9 03 27 pm
screen shot 2015-04-28 at 9 05 16 pm
screen shot 2015-04-28 at 9 07 35 pm
screen shot 2015-04-28 at 9 09 22 pm

AGraph.size() vs graph size attribute: inconsistency and confusion

AGraph class method "size()" does not correspond to the definition of attribute "size" in graphviz 'dot' language.
Whereas in 'dot', size is a graphical attribute, in pygraphviz it returns the number of edges.
This behavior is confusing and undesirable because:

  1. the behavior of size() is not needed as it can be obtained from len(G.edges())
  2. the 'size' attribute in a dot file cannot be accesed, which in my case is a major drawback
  3. consistency is lost between graphviz 'dot' and pygraphviz semantics

Thank you for your work, your library has helped me a lot.

Can't create a non-strict AGraph

>>> import pygraphviz as pgv
>>> g = pgv.AGraph(strict=False)
>>> g.is_strict()
True

I had problems I could not figure out with building and installing pygraphviz 1.3 from source, so I used the third-party binary installer, which only has version 1.2. Sorry if this has been solved.

import error

Hi everyone,

I've installed pygraphviz from git [1] .. and when I import the lib I receive this message error:

>>> import pygraphviz as pgv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/pygraphviz/__init__.py", line 32, in <module>
    from . import release
ImportError: cannot import name 'release'

Any idea?

My best regards,

[1] pip3 install git+git://github.com/pygraphviz/pygraphviz.git

add_subgraph breaks inheritance

The method add_subgraph calls the init method of its class. If called by a class that inherits from AGraph, but doesn't implement all of the parameters for the constructor, it will cause errors.

node_attr broken for subgraphs

node_attr is displayed as graph when the graph is printed.

For example:

>>> import pygraphviz as pgv
>>> a = pgv.AGraph()
>>> s = a.add_subgraph()
>>> s.add_node('c')
>>> s.node_attr.update(shape = 'point')
>>> print s
strict graph {
    graph [shape=point];
    c;
}

>>> print a
strict graph {
    {
        graph [shape=point];
        c;
    }
}

I expected to see node [shape=point]

pip install pygraphviz Missing parentheses in call to 'print'

Hello,

I'm trying to

pip install pygraphviz

but it raises

SyntaxError: Missing parentheses in call to 'print'

I'm using Anaconda Python 3 under Mac OS X

$ python --version
Python 3.4.3 :: Anaconda 2.3.0 (x86_64)

I had a look at Travis https://travis-ci.org/pygraphviz/pygraphviz
it seems that it's working on Python 3.4 (but maybe pip package is not up to date)

you might rename README.txt to README.md or .rst and add a badge using

[![Build Status](https://travis-ci.org/pygraphviz/pygraphviz.svg?branch=master)](https://travis-ci.org/pygraphviz/pygraphviz)

or

.. image:: https://travis-ci.org/pygraphviz/pygraphviz.svg?branch=master
    :target: https://travis-ci.org/pygraphviz/pygraphviz

Kind regards

Installation Error pygraphviz 1.3

Hi... I am getting the error below while installing pygraphviz 1.3 using easy-install / buildout

Traceback (most recent call last):
File "", line 1, in
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/command/easy_install.py", line 2245, in main

File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/command/easy_install.py", line 380, in run

File "build/bdist.macosx-10.10-x86_64/egg/setuptools/command/easy_install.py", line 610, in easy_install

File "build/bdist.macosx-10.10-x86_64/egg/setuptools/command/easy_install.py", line 659, in install_item

File "build/bdist.macosx-10.10-x86_64/egg/setuptools/command/easy_install.py", line 842, in install_eggs

File "build/bdist.macosx-10.10-x86_64/egg/setuptools/command/easy_install.py", line 1070, in build_and_install

File "build/bdist.macosx-10.10-x86_64/egg/setuptools/command/easy_install.py", line 1056, in run_setup

File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 240, in run_setup
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 193, in setup_context
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 164, in save_modules
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 139, in resume
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 152, in save_modules
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 193, in setup_context
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 237, in run_setup
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 267, in run
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 236, in runner
File "build/bdist.macosx-10.10-x86_64/egg/setuptools/sandbox.py", line 46, in _execfile
File "/var/folders/jd/g7fjfbn57695542zy0j_84b40000gn/T/easy_install-sXVhNC/pygraphviz-1.3/setup.py", line 16, in
ImportError: No module named setup_commands
An error occurred when trying to install pygraphviz 1.3. Look above this message for any errors that were output by easy_install.
While:
Installing eggs.
Getting distribution for 'pygraphviz==1.3'.
Error: Couldn't install: pygraphviz 1.3

1.3rc2: Installation issue

python 3.4.3 on OSX: pip install pygraphviz==1.3rc2

causes TypeError: Can't convert 'bytes' object to str implicitly: somewhere around here:

    creating build/temp.macosx-10.10-x86_64-3.4
    creating build/temp.macosx-10.10-x86_64-3.4/pygraphviz
    clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Ib'/usr/local/Cellar/graphviz/2.38.0/include/graphviz' -I/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.10-x86_64-3.4/pygraphviz/graphviz_wrap.o
    pygraphviz/graphviz_wrap.c:3321:12: warning: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
        return agattr(g, kind, name, val);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~

On Ubuntu 12.04: _graphviz.so: undefined symbol: Agundirected

I've done the following on my dev hosts for a while now. I needed to bring up pygraphviz on a somewhat-freshly imaged host, and got a new error that I've not seen before when I tried to import (see last output; install seems to be smooth):

$ dpkg -s graphviz-dev
Package: graphviz-dev
Status: install ok installed
Priority: optional
Section: devel
Installed-Size: 90
Maintainer: Ubuntu Developers [email protected]
Architecture: all
Source: graphviz
Version: 2.26.3-10ubuntu1.2
Depends: libgraphviz-dev

v$ pip install pygraphviz
Downloading/unpacking pygraphviz
Downloading pygraphviz-1.3.1.tar.gz (103kB): 103kB downloaded
Running setup.py (path:/home/elis/venv/mobius3d_dev/build/pygraphviz/setup.py) egg_info for package pygraphviz

warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc/build'

Installing collected packages: pygraphviz
Running setup.py install for pygraphviz
Trying pkg-config
include_dirs=/usr/include/graphviz
library_dirs=

warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc/build'
building 'pygraphviz._graphviz' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/graphviz -I/usr/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c: In function ‘agattr_label’:
pygraphviz/graphviz_wrap.c:3321:5: warning: return makes integer from pointer without a cast [enabled by default]
pygraphviz/graphviz_wrap.c: In function ‘_wrap_agread’:
pygraphviz/graphviz_wrap.c:3408:9: warning: unused variable ‘mode1’ [-Wunused-variable]
pygraphviz/graphviz_wrap.c:3407:13: warning: unused variable ‘mode_byte_obj1’ [-Wunused-variable]
pygraphviz/graphviz_wrap.c:3406:13: warning: unused variable ‘mode_obj1’ [-Wunused-variable]
pygraphviz/graphviz_wrap.c:3405:7: warning: unused variable ‘fd1’ [-Wunused-variable]
pygraphviz/graphviz_wrap.c: In function ‘_wrap_agwrite’:
pygraphviz/graphviz_wrap.c:3466:9: warning: unused variable ‘mode2’ [-Wunused-variable]
pygraphviz/graphviz_wrap.c:3465:13: warning: unused variable ‘mode_byte_obj2’ [-Wunused-variable]
pygraphviz/graphviz_wrap.c:3464:13: warning: unused variable ‘mode_obj2’ [-Wunused-variable]
pygraphviz/graphviz_wrap.c:3463:7: warning: unused variable ‘fd2’ [-Wunused-variable]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/pygraphviz/graphviz_wrap.o -L -lcgraph -lcdt -o build/lib.linux-x86_64-2.7/pygraphviz/_graphviz.so

Successfully installed pygraphviz
Cleaning up...

$ python -c 'import pygraphviz'
Traceback (most recent call last):
File "", line 1, in
File "/home/elis/venv/mobius3d_dev/local/lib/python2.7/site-packages/pygraphviz/init.py", line 58, in
from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute, DotError
File "/home/elis/venv/mobius3d_dev/local/lib/python2.7/site-packages/pygraphviz/agraph.py", line 26, in
from . import graphviz as gv
File "/home/elis/venv/mobius3d_dev/local/lib/python2.7/site-packages/pygraphviz/graphviz.py", line 28, in
_graphviz = swig_import_helper()
File "/home/elis/venv/mobius3d_dev/local/lib/python2.7/site-packages/pygraphviz/graphviz.py", line 24, in swig_import_helper
_mod = imp.load_module('_graphviz', fp, pathname, description)
ImportError: /home/elis/venv/mobius3d_dev/local/lib/python2.7/site-packages/pygraphviz/_graphviz.so: undefined symbol: Agundirected

Non-Strict directed graphs with self-loops

Constructor of a agraph has a parameter "strict". This parameter is sent to the method "agraphnew" and based on that a parameter into the Graphviz's graph constructor is sent (e.g. cvar.Agdirected / cvar.Agstrictdirected),
My problem with this is that no matter what is sent to Graphviz's constructor, it will always be a strict graph by Graphviz.

        print("Strict Python: " + str(strict))
        a = _graphviz.agopen(name,cvar.Agdirected,None)
        print("Strict GV: " + str(_graphviz.agisstrict(a)))

This will tell me:

        Strict Python: False
        Strict GV: 1

Next time someone asks if a initially non-strict AGraph is strict (via is_strict()) it will say that it is.

I actually want to create a DiGraph with self-loops, but no repeating edges from NetworkX, but when I output a dot file it via Graphviz, the self-loops are not there and the dot file says it's a strict graph (when it initially wasn't).

There will be some errors from Graphviz that are silenced when a self-loop is being added:

      try:
        if key is not None:
            if not self._is_string_like(key):
                key=str(key)
            key=key.encode(self.encoding)
        eh=gv.agedge(self.handle,uh,vh,key,_Action.create)
        e=Edge(self,eh=eh)
        e.attr.update(**attr)
    except KeyError:
        print("error")
        return None # silent failure for strict graph, already added

Output:

    0->0
    error
    0->1
    1->1
    error

I have Windows 8, Python 2.7, NetworkX 1.8.1, PyGraphviz 1.2, Graphviz 2.34
Graphviz doc says that a strict graph should allow for self-loops, but a simple graph shouldn't. http://www.graphviz.org/pdf/cgraph.3.pdf

How to repeat:

    import networkx as nx
    graph = nx.DiGraph()
    graph.add_edge(0, 0)
    graph.add_edge(0, 1)
    graph.add_edge(1, 1)
    nx.write_dot(graph,'graph.dot')

please add LICENSE file

I'm packaging pygraphviz for Fedora, and it would be nice to have a seperate file stating the license.

Pkg-config-discovered graphviz include directory is incorrect on OS X 10.11 with a homebrew-installed graphviz

Installing pygraphviz using pip on OS X 10.11 using a homebrew-installed graphviz fails with the following error.

    clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/graphviz/2.38.0/include/graphviz -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.11-x86_64-2.7/pygraphviz/graphviz_wrap.o
pygraphviz/graphviz_wrap.c:2954:10: fatal error: 'graphviz/cgraph.h' file not found
#include "graphviz/cgraph.h"

This appears to be the same error that is being addressed in #73 with an Ubuntu-specific alternative to the automatic include-path discovery.

The discovery logic using pkg-config results in the following include path being found.

$ pkg-config --cflags-only-I libcgraph
-I/usr/local/Cellar/graphviz/2.38.0/include/graphviz

However the actual header file referenced in pygraphviz_wrap.c is at /usr/local/Cellar/graphviz/2.38.0/include/graphviz/cgraph.h, so the include directive #include "graphviz/cgraph.h" will fail (whereas I assume #include "cgraph.h" would be OK).

I do not know what affect the various solution that spring to mind (e.g. changing the include directive in pygraphviz_wrap.c; or checking that the auto-discovered include path actually contains the header files with an appropriate relative path and trying to strip the base directory from the path, if not) might have on installations for other platforms, so am hesitant to suggest a fix without discussion of the issue.

remove_node appears to be broken for Unicode node names

Attempting to remove a node with characters outside the ASCII set gives me the error
File "/usr/lib/pymodules/python2.7/pygraphviz/agraph.py", line 326, in remove_node
nh=gv.agnode(self.handle,n.encode(self.encoding),_Action.find)
UnicodeDecodeError

Looking at the function, it appears the problem has to do with n.encode being called twice on itself; removing one of the two calls seems to fix the problem.

args="-n2" in draw() method causes error

I have a dot file with the pos attribute defined for all nodes. I'd like to draw it without applying any layout. This can be done with neato and the -n2 option. I follow the example, miles.py from this repository and I get an error.
The method call:
biogrid_pgv.draw("biogrid.svg",prog="neato",args="-n2")
The error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-95-1425a4ad4f8d> in <module>()
      1 biogrid_pgv = pgv.AGraph("biogrid.dot")
----> 2 biogrid_pgv.draw("biogrid.svg",prog="neato",args="-n2")

/cellar/users/mahermassoud/anaconda3/lib/python3.4/site-packages/pygraphviz/agraph.py in draw(self, path, format, prog, args)
   1466             args = ' '.join([args, "-T" + format])
   1467 
-> 1468         data = self._run_prog(prog, args)
   1469 
   1470         if path is not None:

/cellar/users/mahermassoud/anaconda3/lib/python3.4/site-packages/pygraphviz/agraph.py in _run_prog(self, prog, args)
   1330 
   1331         if len(errors) > 0:
-> 1332             warnings.warn(b"".join(errors), RuntimeWarning)
   1333 
   1334         return b"".join(data)

TypeError: can't use a string pattern on a bytes-like object

Running the effective equivalent on the same file,
neato -n2 -Tsvg biogrid.dot > biogrid.svg in terminal yields expected results.
Does someone have an idea where I can look to fix this? I am using PGV 1.3rc2

file.name may not be present on all file like objects. path.name can throw exception.

From Python specification:

file.name
If the file object was created using open(), the name of the file. Otherwise, some string that indicates the source of the file object, of the form <...>. This is a read-only attribute and may not be present on all file-like objects.

So,
https://github.com/pygraphviz/pygraphviz/blob/master/pygraphviz/agraph.py#L1451
works with file handlers what was created using open().

This issue doesn't allow to use StringIO objects with pygraphviz module without mandatory format parameter. Default format ('dot') is not applicable in this case. At least, the docstring should be updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.