<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>API Notes — PyGraphviz 1.5 documentation</title> <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/language_data.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within PyGraphviz 1.5 documentation" href="../_static/opensearch.xml"/> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="News" href="news.html" /> <link rel="prev" title="FAQ" href="faq.html" /> <link rel="stylesheet" href="../_static/custom.css" type="text/css" /> <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" /> </head><body> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="api-notes"> <h1>API Notes<a class="headerlink" href="#api-notes" title="Permalink to this headline">¶</a></h1> <div class="section" id="pygraphviz-1-2"> <h2>pygraphviz-1.2<a class="headerlink" href="#pygraphviz-1-2" title="Permalink to this headline">¶</a></h2> <blockquote> <div>No API changes</div></blockquote> </div> <div class="section" id="pygraphviz-1-1"> <h2>pygraphviz-1.1<a class="headerlink" href="#pygraphviz-1-1" title="Permalink to this headline">¶</a></h2> <blockquote> <div><p>Pygraphviz-1.1 adds unicode (graphviz charset) support. The default Node type is now unicode. See examples/utf8.py for an example of how to use non-ASCII characters.</p> <p>The __str__ and __repr__ methods have been rewritten and a __unicode__ method added.</p> <p>If G is a pygraphviz.AGraph object then</p> <ul class="simple"> <li>str(G) produces a dot-format string representation (some characters might not be represented correctly)</li> <li>unicode(G) produces a dot-format unicode representation</li> <li>repr(G) produces a string of the unicode representation.</li> <li>print G produces a formatted dot language output</li> </ul> </div></blockquote> </div> <div class="section" id="pygraphivz-0-32"> <h2>pygraphivz-0.32<a class="headerlink" href="#pygraphivz-0-32" title="Permalink to this headline">¶</a></h2> <blockquote> <div><p>pygraphviz-0.32 is a rewrite of pygraphviz-0.2x with some significant changes in the API and Graphviz wrapper. It is not compatible with with earlier versions.</p> <p>The goal of pygraphviz is to provide a (mostly) Pythonic interface to the Graphviz Agraph data-structure, layout, and drawing algorithms.</p> <p>The API is now similar to the NetworkX API. Studying the documentation and Tutorial for NetworkX will teach you most of what you need to know for pygraphviz. For a short introduction on pygraphviz see the pygraphviz Tutorial.</p> <p>There are some important differences between the PyGraphviz and NetworkX API. With PyGraphviz</p> <blockquote> <div><ul class="simple"> <li>All nodes must be of string or unicode type. An attempt will be made to convert other types to a string.</li> <li>Nodes and edges are custom Python objects. Nodes are like unicode/string objects and edges are like tuple objects. (In NetworkX nodes can be anything and edges are two- or three-tuples.)</li> <li>Graphs, edges, and nodes may have attributes such as color, size, shape, attached to them. If the attributes are known Graphviz attributes they will be used for drawing and layout.</li> <li>The layout() and draw() methods allow positioning of nodes and rendering in all of the supported Graphviz output formats.</li> <li>The string() method produces a string with the graph represented in Graphviz dot format. See also from_string().</li> <li>The subgraph() method is the Graphviz representation of subgraphs: a tree of graphs under the original (root) graph. The are primarily used for clustering of nodes when drawing with dot.</li> </ul> </div></blockquote> <p>Pygraphviz supports most of the Graphviz API.</p> </div></blockquote> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h1 class="logo"><a href="../index.html">PyGraphviz</a></h1> <h3>Navigation</h3> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../download.html">Download</a></li> <li class="toctree-l1"><a class="reference internal" href="../install.html">Installing</a></li> <li class="toctree-l1"><a class="reference internal" href="../tutorial.html">Tutorial</a></li> <li class="toctree-l1 current"><a class="reference internal" href="index.html">Reference</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="agraph.html">AGraph Class</a></li> <li class="toctree-l2"><a class="reference internal" href="faq.html">FAQ</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">API Notes</a></li> <li class="toctree-l2"><a class="reference internal" href="news.html">News</a></li> <li class="toctree-l2"><a class="reference internal" href="related.html">Related Pacakges</a></li> <li class="toctree-l2"><a class="reference internal" href="history.html">History</a></li> <li class="toctree-l2"><a class="reference internal" href="credits.html">Credits</a></li> <li class="toctree-l2"><a class="reference internal" href="legal.html">Legal</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li> </ul> <div class="relations"> <h3>Related Topics</h3> <ul> <li><a href="../index.html">Documentation overview</a><ul> <li><a href="index.html">Reference</a><ul> <li>Previous: <a href="faq.html" title="previous chapter">FAQ</a></li> <li>Next: <a href="news.html" title="next chapter">News</a></li> </ul></li> </ul></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="footer"> ©2004-2019, PyGraphviz Developers. | Powered by <a href="http://sphinx-doc.org/">Sphinx 1.8.3</a> & <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a> </div> </body> </html>