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:

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.
  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).
  link(self, docstring_linker)
Replace any href attributes whose value is <name> with the url of the object whose name is <name>.
  _link_href(self, attribs, docstring_linker)
Helper for link()
  write(self, filename, language='gif')
Render the graph using the output format language, and write the result to filename.
  render(self, language='gif')
Use the dot command to render this graph, using the output format language.
  _run_dot(self, *options)
  to_dotfile(self)
Return the string contents of the dot file that should be used to render this graph.

Class Variables [hide private]
_uids A set of all uids that that have been generated, used to ensure that each new graph has a unique uid.
DEFAULT_NODE_DEFAULTS  
DEFAULT_EDGE_DEFAULTS  

Instance Variables [hide private]
title The title of the graph.
caption A caption for the graph.
nodes A list of the nodes that are present in the graph.
edges A list of the edges that are present in the graph.
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 
Create a new DotGraph.

to_html(self, image_file, image_url, center=True)

source code 
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.

link(self, docstring_linker)

source code 
Replace any href attributes whose value is <name> with the url of the object whose name is <name>.

_link_href(self, attribs, docstring_linker)

source code 
Helper for link()

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.

_run_dot(self, *options)

source code 

to_dotfile(self)

source code 
Return the string contents of the dot file that should be used to render this graph.

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__colorize_re', 'class_hierarchy_for_apidoc', 'cal\
l_graph_for_user_docfields', 'call_graph_for__get_canonical_', 'call_g\
raph_for_render', 'call_graph_for_get_value_from_', 'call_graph_for_de\
code_with_bac', 'call_graph_for_write_latex', 'call_graph_for_write', \
'call_graph_for__add_section', u'overview_of_epydoc_s_architect', 'cal\
l_graph_for__name', 'call_graph_for__report_bad_bas', 'call_graph_for_\
process_multi_s', 'call_graph_for__tokenize_para', 'call_graph_for_mer\
ge_docs', 'call_graph_for__import_var', 'call_graph_for__get_module_na\
...                                                                    
      

DEFAULT_NODE_DEFAULTS

Value:
{'fontname': 'helvetica', 'fontsize': 10}                              
      

DEFAULT_EDGE_DEFAULTS

Value:
{'fontname': 'helvetica', 'fontsize': 10}                              
      

Instance Variable Details [hide private]

title

The title of the graph.

caption

A caption for the graph.

nodes

A list of the nodes that are present in the graph.
Type:
list of DotGraphNode

edges

A list of the edges that are present in the graph.
Type:
list of DotGraphEdge

body

A string that should be included as-is in the body of the graph.
Type:
str

node_defaults

Default attribute values for nodes.

edge_defaults

Default attribute values for edges.

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.