Package epydoc :: Package docwriter :: Module dotgraph :: Class DotGraph
[hide private]
[frames] | no frames]

type DotGraph

source code


A dot directed graph. The contents of the graph are constructed from the following instance variables:

The link() method can be used to resolve crossreference links within the graph. In particular, if the 'href' attribute of any node or edge is assigned a value of the form <name>, then it will be replaced by the URL of the object with that name. This applies to the body as well as the nodes and edges.

To render the graph, use the methods write() and render(). Usually, you should call link() before you render the graph.

Instance Methods [hide private]
 
__init__(self, title, body='', node_defaults=None, edge_defaults=None, caption=None)
Create a new DotGraph.
source code
call graph 
 
to_latex(self, directory, center=True, size=None)
Return the LaTeX code that should be used to display this graph.
source code
 
_to_dot2tex(self, center=True, size=None) source code
 
to_html(self, directory, center=True, size=None)
Return the HTML code that should be uesd to display this graph (including a client-side image map).
source code
call graph 
 
link(self, docstring_linker)
Replace any href attributes whose value is <name> with the url of the object whose name is <name>.
source code
call graph 
 
_link_href(self, attribs, docstring_linker)
Helper for link()
source code
call graph 
 
write(self, filename, language=None, size=None)
Render the graph using the output format language, and write the result to filename.
source code
 
_pick_language(self, filename) source code
call graph 
 
render(self, language=None, size=None)
Use the dot command to render this graph, using the output format language.
source code
 
_run_dot(self, *options, **kwparam) source code
call graph 
 
to_dotfile(self, size=None)
Return the string contents of the dot file that should be used to render this graph.
source code
call graph 
Class Variables [hide private]
  _uids = set([u'call_graph_for___add__', u'call_graph_for___cmp...
A set of all uids that that have been generated, used to ensure that each new graph has a unique uid.
  DEFAULT_NODE_DEFAULTS = {'fontname': 'Helvetica', 'fontsize': 10}
  DEFAULT_EDGE_DEFAULTS = {'fontname': 'Helvetica', 'fontsize': 10}
  DEFAULT_LATEX_SIZE = '6.25,8'
The default minimum size in inches (width,height) for graphs when rendering with to\_latex()
  DEFAULT_HTML_SIZE = '10,20'
The default minimum size in inches (width,height) for graphs when rendering with to\_html()
  DEFAULT_HTML_IMAGE_FORMAT = 'gif'
The default format used to generate images by to\_html()
Instance Variables [hide private]
  title
The title of the graph.
  caption
A caption for the graph.
list of DotGraphNode nodes
A list of the nodes that are present in the graph.
list of DotGraphEdge edges
A list of the edges that are present in the graph.
str body
A string that should be included as-is in the body of the graph.
  node_defaults
Default attribute values for nodes.
  edge_defaults
Default attribute values for edges.
  uid
A unique identifier for this graph.
Method Details [hide private]

__init__(self, title, body='', node_defaults=None, edge_defaults=None, caption=None)
(Constructor)

source code 
call graph 
Create a new DotGraph.
Overrides: object.__init__

to_latex(self, directory, center=True, size=None)

source code 
Return the LaTeX code that should be used to display this graph. Two image files will be written: image_file+'.eps' and image_file+'.pdf'.
Parameters:
  • size (str) - The maximum size for the generated image, in inches. In particular, if size is "w,h", then this will add a line size="w,h" to the dot graph. Defaults to DEFAULT\_LATEX\_SIZE.

to_html(self, directory, center=True, size=None)

source code 
call graph 
Return the HTML code that should be uesd to display this graph (including a client-side image map).
Parameters:
  • image_url - The URL of the image file for this graph; this should be generated separately with the write() method.
  • size (str) - The maximum size for the generated image, in inches. In particular, if size is "w,h", then this will add a line size="w,h" to the dot graph. Defaults to DEFAULT\_HTML\_SIZE.

write(self, filename, language=None, size=None)

source code 
Render the graph using the output format language, and write the result to filename.
Parameters:
  • size (str) - The maximum size for the generated image, in inches. In particular, if size is "w,h", then this will add a line size="w,h" to the dot graph. If not specified, no size line will be added.
Returns:
True if rendering was successful.

render(self, language=None, size=None)

source code 
Use the dot command to render this graph, using the output format language. Return the result as a string, or None if the rendering failed.
Parameters:
  • size (str) - The maximum size for the generated image, in inches. In particular, if size is "w,h", then this will add a line size="w,h" to the dot graph. If not specified, no size line will be added.

to_dotfile(self, size=None)

source code 
call graph 
Return the string contents of the dot file that should be used to render this graph.
Parameters:
  • size (str) - The maximum size for the generated image, in inches. In particular, if size is "w,h", then this will add a line size="w,h" to the dot graph. If not specified, no size line will be added.

Class Variable Details [hide private]

_uids

A set of all uids that that have been generated, used to ensure that each new graph has a unique uid.
Value:
set([u'call_graph_for___add__',
     u'call_graph_for___cmp__',
     u'call_graph_for___cmp___2',
     u'call_graph_for___cmp___3',
     u'call_graph_for___getitem__',
     u'call_graph_for___getstate__',
     u'call_graph_for___hash__',
     u'call_graph_for___hash___2',
...

Instance Variable Details [hide private]

uid

A unique identifier for this graph. This can be used as a filename when rendering the graph. No two DotGraphs will have the same uid.