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

# Class DotGraph

source code

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

> - nodes: A list of DotGraphNodes, encoding the nodes that are present in the graph. Each node is characterized a set of attributes, including an optional label.
> - edges: A list of DotGraphEdges, encoding the edges that are present in the graph. Each edge is characterized by a set of attributes, including an optional label.
> - node_defaults: Default attributes for nodes.
> - edge_defaults: Default attributes for edges.
> - body: A string that is appended as-is in the body of the graph. This can be used to build more complex dot graphs.

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
Call Graph
to_html(self, image_file, image_url, center=True) Return the HTML code that should be uesd to display this graph (including a client-side image map). | source code call graph
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
Call Graph
_link_href(self, attribs, docstring_linker) Helper for link() | source code call graph
Call Graph
write(self, filename, language=`'``gif``'`) Render the graph using the output format `language`, and write the result to `filename`. | source code
render(self, language=`'``gif``'`) Use the `dot` command to render this graph, using the output format `language`. | source code
_run_dot(self, *options) | source code call graph
Call Graph
to_dotfile(self) Return the string contents of the dot file that should be used to render this graph. | source code call graph
Call Graph

Class Variables | [hide private]
| _uids = ``set([``'``call_graph_for___add__``'``,` `'``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`}``

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]

### to_html(self, image_file, image_url, center=True) | source code call graph
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.

### write(self, filename, language=`'``gif``'`) | source code
Render the graph using the output format `language`, and write the result to `filename`. Returns: True if rendering was successful.

### render(self, language=`'``gif``'`) | 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.

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(['call_graph_for___add__',
           'call_graph_for___cmp__',
           'call_graph_for___cmp___2',
           'call_graph_for___cmp___3',
           'call_graph_for___getitem__',
           'call_graph_for___getstate__',
           'call_graph_for___hash__',
           '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.