<!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="Content-Type" content="text/html; charset=utf-8" /> <title>API Notes — PyGraphviz v1.1.dev1952 documentation</title> <link rel="stylesheet" href="../_static/sphinxdoc.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '1.1.dev1952', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: false }; </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> <link rel="search" type="application/opensearchdescription+xml" title="Search within PyGraphviz v1.1.dev1952 documentation" href="../_static/opensearch.xml"/> <link rel="top" title="PyGraphviz v1.1.dev1952 documentation" href="../index.html" /> <link rel="up" title="Reference" href="index.html" /> <link rel="next" title="News" href="news.html" /> <link rel="prev" title="FAQ" href="faq.html" /> </head> <body> <div style="color: black;background-color: white; font-size: 3.2em; text-align: left; padding: 15px 10px 10px 15px"> PyGraphviz </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="news.html" title="News" accesskey="N">next</a> |</li> <li class="right" > <a href="faq.html" title="FAQ" accesskey="P">previous</a> |</li> <li><a href="../index.html">PyGraphviz Home </a> | </li> <li><a href="../search.html">Search </a> | </li> <li><a href="../download.html">Download </a> | </li> <li><a href="http://networkx.lanl.gov/trac/wiki/PyGraphviz">Developer Site</a> | </li> <li><a href="../contents.html">Documentation </a> »</li> <li><a href="index.html" accesskey="U">Reference</a> »</li> </ul> </div> <p>This documentation is for version <b>1.1.dev1952</b>, which is not released yet.</p> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../contents.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">API Notes</a><ul> <li><a class="reference internal" href="#pygraphviz-1-1">pygraphviz-1.1</a></li> <li><a class="reference internal" href="#pygraphivz-0-32">pygraphivz-0.32</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="faq.html" title="previous chapter">FAQ</a></p> <h4>Next topic</h4> <p class="topless"><a href="news.html" title="next chapter">News</a></p> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <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-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="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="news.html" title="News" >next</a> |</li> <li class="right" > <a href="faq.html" title="FAQ" >previous</a> |</li> <li><a href="../index.html">PyGraphviz Home </a> | </li> <li><a href="../search.html">Search </a> | </li> <li><a href="../download.html">Download </a> | </li> <li><a href="http://networkx.lanl.gov/trac/wiki/PyGraphviz">Developer Site</a> | </li> <li><a href="../contents.html">Documentation </a> »</li> <li><a href="index.html" >Reference</a> »</li> </ul> </div> <div class="footer"> © Copyright 2010, Aric Hagberg. Last updated on Jun 01, 2011. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. </div> </body> </html>