pydot (version 1.0.2)
index
/Volumes/Personal Image/Devel/pydot/pydot.py

Graphviz's dot language Python interface.
 
This module provides with a full interface to create handle modify
and process graphs in Graphviz's dot language.
 
References:
 
pydot Homepage: http://www.dkbza.org/pydot.html
Graphviz:       http://www.research.att.com/sw/tools/graphviz/
DOT Language:   http://www.research.att.com/~erg/graphviz/info/lang.html
 
Programmed and tested with Graphviz 1.16 and Python 2.3.4 on GNU/Linux
by Ero Carrera (c) 2004 [ero@dkbza.org]
 
Distributed under MIT license [http://opensource.org/licenses/mit-license.html].

 
Modules
       
copy
dot_parser
os
re
subprocess
tempfile

 
Classes
       
__builtin__.dict(__builtin__.object)
frozendict
__builtin__.object
Edge(__builtin__.object, Common)
Graph(__builtin__.object, Common)
Cluster
Dot
Subgraph
Node(__builtin__.object, Common)
exceptions.Exception(exceptions.BaseException)
Error
InvocationException
Common
Edge(__builtin__.object, Common)
Graph(__builtin__.object, Common)
Cluster
Dot
Subgraph
Node(__builtin__.object, Common)

 
class Cluster(Graph)
    Class representing a cluster in Graphviz's dot language.
 
This class implements the methods to work on a representation
of a cluster in Graphviz's dot language.
 
cluster(graph_name='subG', suppress_disconnected=False, attribute=value, ...)
 
graph_name:
    the cluster's name (the string 'cluster' will be always prepended)
suppress_disconnected:
    defaults to false, which will remove from the
    cluster any disconnected nodes.
All the attributes defined in the Graphviz dot language should
be supported.
 
Attributes can be set through the dynamically generated methods:
 
 set_[attribute name], i.e. set_color, set_fontname
 
or using the instance's attributes:
 
 Cluster.[attribute name], i.e.
    cluster_instance.color, cluster_instance.fontname
 
 
Method resolution order:
Cluster
Graph
__builtin__.object
Common

Methods defined here:
__init__(self, graph_name='subG', obj_dict=None, suppress_disconnected=False, simplify=False, **attrs)

Methods inherited from Graph:
add_edge(self, graph_edge)
Adds an edge object to the graph.
 
It takes a edge object as its only argument and returns
None.
add_node(self, graph_node)
Adds a node object to the graph.
 
It takes a node object as its only argument and returns
None.
add_subgraph(self, sgraph)
Adds an subgraph object to the graph.
 
It takes a subgraph object as its only argument and returns
None.
get_edge(self, src, dst)
Retrieved an edge from the graph.
 
Given an edge's source and destination the corresponding
Edge instance will be returned.
 
If multiple edges exist with that source and destination,
a list of Edge instances is returned.
If only one edge exists, the instance is returned.
None is returned otherwise.
get_edge_defaults(self, **attrs)
get_edge_list(self)
Get the list of Edge instances.
 
This method returns the list of Edge instances
composing the graph.
get_edges(self)
get_graph_defaults(self, **attrs)
get_graph_type(self)
get_name(self)
Get the graph's name.
get_next_sequence_number(self)
get_node(self, name)
Retrieved a node from the graph.
 
Given a node's name the corresponding Node
instance will be returned.
 
If multiple nodes exist with that name, a list of
Node instances is returned.
If only one node exists, the instance is returned.
None is returned otherwise.
get_node_defaults(self, **attrs)
get_node_list(self)
Get the list of Node instances.
 
This method returns the list of Node instances
composing the graph.
get_nodes(self)
Return an iterator.
get_simplify(self)
Get whether to simplify or not.
 
Refer to set_simplify for more information.
get_strict(self, val)
Get graph's 'strict' mode (True, False).
 
This option is only valid for top level graphs.
get_subgraph(self, name)
Retrieved a subgraph from the graph.
 
Given a subgraph's name the corresponding
Subgraph instance will be returned.
 
If multiple subgraphs exist with the same name, a list of
Subgraph instances is returned.
If only one Subgraph exists, the instance is returned.
None is returned otherwise.
get_subgraph_list(self)
Get the list of Subgraph instances.
 
This method returns the list of Subgraph instances
in the graph.
get_subgraphs(self)
get_suppress_disconnected(self, val)
Get if suppress disconnected is set.
 
Refer to set_suppress_disconnected for more information.
get_top_graph_type(self)
get_type(self)
Get the graph's type, 'graph' or 'digraph'.
set_edge_defaults(self, **attrs)
set_graph_defaults(self, **attrs)
set_name(self, graph_name)
Set the graph's name.
set_node_defaults(self, **attrs)
set_parent_graph(self, parent_graph)
set_simplify(self, simplify)
Set whether to simplify or not.
 
If True it will avoid displaying equal edges, i.e.
only one edge between two nodes. removing the
duplicated ones.
set_strict(self, val)
Set graph to 'strict' mode.
 
This option is only valid for top level graphs.
set_suppress_disconnected(self, val)
Suppress disconnected nodes in the output graph.
 
This option will skip nodes in the graph with no        incoming or outgoing
edges. This option works also for subgraphs and has effect only in the
current graph/subgraph.
set_type(self, graph_type)
Set the graph's type, 'graph' or 'digraph'.
to_string(self)
Returns a string representation of the graph in dot language.
 
It will return the graph and all its subelements in string from.

Data descriptors inherited from Graph:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from Common:
__get_attribute__(self, attr)
Look for default attributes for this node
__getstate__(self)
__setstate__(self, state)
create_attribute_methods(self, obj_attributes)
get(self, name)
Get an attribute value by name.
 
Given an attribute 'name' it will get its value.
There's always the possibility of using the methods:
 
    get_'name'()
    
which are defined for all the existing attributes.
get_attributes(self)
get_parent_graph(self)
get_sequence(self)
set(self, name, value)
Set an attribute value by name.
 
Given an attribute 'name' it will set its value to 'value'.
There's always the possibility of using the methods:
 
    set_'name'(value)
    
which are defined for all the existing attributes.
set_sequence(self, seq)

 
class Common
    Common information to several classes.
 
Should not be directly used, several classes are derived from
this one.
 
  Methods defined here:
__get_attribute__(self, attr)
Look for default attributes for this node
__getstate__(self)
__setstate__(self, state)
create_attribute_methods(self, obj_attributes)
get(self, name)
Get an attribute value by name.
 
Given an attribute 'name' it will get its value.
There's always the possibility of using the methods:
 
    get_'name'()
    
which are defined for all the existing attributes.
get_attributes(self)
get_parent_graph(self)
get_sequence(self)
set(self, name, value)
Set an attribute value by name.
 
Given an attribute 'name' it will set its value to 'value'.
There's always the possibility of using the methods:
 
    set_'name'(value)
    
which are defined for all the existing attributes.
set_parent_graph(self, parent_graph)
set_sequence(self, seq)

 
class Dot(Graph)
    A container for handling a dot language file.
 
This class implements methods to write and process
a dot language file. It is a derived class of
the base class 'Graph'.
 
 
Method resolution order:
Dot
Graph
__builtin__.object
Common

Methods defined here:
__getstate__(self)
__init__(self, *argsl, **argsd)
create(self, prog=None, format='ps')
Creates and returns a Postscript representation of the graph.
 
create will write the graph to a temporary dot file and process
it with the program given by 'prog' (which defaults to 'twopi'),
reading the Postscript output and returning it as a string is the
operation is successful.
On failure None is returned.
 
There's also the preferred possibility of using:
 
    create_'format'(prog='program')
    
which are automatically defined for all the supported formats.
[create_ps(), create_gif(), create_dia(), ...]
set_graphviz_executables(self, paths)
This method allows to manually specify the location of the GraphViz executables.
 
The argument to this method should be a dictionary where the keys are as follows:
 
    {'dot': '', 'twopi': '', 'neato': '', 'circo': '', 'fdp': ''}
    
and the values are the paths to the corresponding executable, including the name
of the executable itself.
set_prog(self, prog)
Sets the default program.
 
Sets the default program in charge of processing
the dot file into a graph.
set_shape_files(self, file_paths)
Add the paths of the required image files.
 
If the graph needs graphic objects to be used as shapes or otherwise
those need to be in the same folder as the graph is going to be rendered
from. Alternatively the absolute path to the files can be specified when
including the graphics in the graph.
 
The files in the location pointed to by the path(s) specified as arguments
to this method will be copied to the same temporary location where the
graph is going to be rendered.
write(self, path, prog=None, format='raw')
Writes a graph to a file.
 
Given a filename 'path' it will open/create and truncate
such file and write on it a representation of the graph
defined by the dot object and in the format specified by
'format'.
The format 'raw' is used to dump the string representation
of the Dot object, without further processing.
The output can be processed by any of graphviz tools, defined
in 'prog', which defaults to 'dot'
Returns True or False according to the success of the write
operation.
 
There's also the preferred possibility of using:
 
    write_'format'(path, prog='program')
    
which are automatically defined for all the supported formats.
[write_ps(), write_gif(), write_dia(), ...]

Methods inherited from Graph:
add_edge(self, graph_edge)
Adds an edge object to the graph.
 
It takes a edge object as its only argument and returns
None.
add_node(self, graph_node)
Adds a node object to the graph.
 
It takes a node object as its only argument and returns
None.
add_subgraph(self, sgraph)
Adds an subgraph object to the graph.
 
It takes a subgraph object as its only argument and returns
None.
get_edge(self, src, dst)
Retrieved an edge from the graph.
 
Given an edge's source and destination the corresponding
Edge instance will be returned.
 
If multiple edges exist with that source and destination,
a list of Edge instances is returned.
If only one edge exists, the instance is returned.
None is returned otherwise.
get_edge_defaults(self, **attrs)
get_edge_list(self)
Get the list of Edge instances.
 
This method returns the list of Edge instances
composing the graph.
get_edges(self)
get_graph_defaults(self, **attrs)
get_graph_type(self)
get_name(self)
Get the graph's name.
get_next_sequence_number(self)
get_node(self, name)
Retrieved a node from the graph.
 
Given a node's name the corresponding Node
instance will be returned.
 
If multiple nodes exist with that name, a list of
Node instances is returned.
If only one node exists, the instance is returned.
None is returned otherwise.
get_node_defaults(self, **attrs)
get_node_list(self)
Get the list of Node instances.
 
This method returns the list of Node instances
composing the graph.
get_nodes(self)
Return an iterator.
get_simplify(self)
Get whether to simplify or not.
 
Refer to set_simplify for more information.
get_strict(self, val)
Get graph's 'strict' mode (True, False).
 
This option is only valid for top level graphs.
get_subgraph(self, name)
Retrieved a subgraph from the graph.
 
Given a subgraph's name the corresponding
Subgraph instance will be returned.
 
If multiple subgraphs exist with the same name, a list of
Subgraph instances is returned.
If only one Subgraph exists, the instance is returned.
None is returned otherwise.
get_subgraph_list(self)
Get the list of Subgraph instances.
 
This method returns the list of Subgraph instances
in the graph.
get_subgraphs(self)
get_suppress_disconnected(self, val)
Get if suppress disconnected is set.
 
Refer to set_suppress_disconnected for more information.
get_top_graph_type(self)
get_type(self)
Get the graph's type, 'graph' or 'digraph'.
set_edge_defaults(self, **attrs)
set_graph_defaults(self, **attrs)
set_name(self, graph_name)
Set the graph's name.
set_node_defaults(self, **attrs)
set_parent_graph(self, parent_graph)
set_simplify(self, simplify)
Set whether to simplify or not.
 
If True it will avoid displaying equal edges, i.e.
only one edge between two nodes. removing the
duplicated ones.
set_strict(self, val)
Set graph to 'strict' mode.
 
This option is only valid for top level graphs.
set_suppress_disconnected(self, val)
Suppress disconnected nodes in the output graph.
 
This option will skip nodes in the graph with no        incoming or outgoing
edges. This option works also for subgraphs and has effect only in the
current graph/subgraph.
set_type(self, graph_type)
Set the graph's type, 'graph' or 'digraph'.
to_string(self)
Returns a string representation of the graph in dot language.
 
It will return the graph and all its subelements in string from.

Data descriptors inherited from Graph:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from Common:
__get_attribute__(self, attr)
Look for default attributes for this node
__setstate__(self, state)
create_attribute_methods(self, obj_attributes)
get(self, name)
Get an attribute value by name.
 
Given an attribute 'name' it will get its value.
There's always the possibility of using the methods:
 
    get_'name'()
    
which are defined for all the existing attributes.
get_attributes(self)
get_parent_graph(self)
get_sequence(self)
set(self, name, value)
Set an attribute value by name.
 
Given an attribute 'name' it will set its value to 'value'.
There's always the possibility of using the methods:
 
    set_'name'(value)
    
which are defined for all the existing attributes.
set_sequence(self, seq)

 
class Edge(__builtin__.object, Common)
    A graph edge.
 
This class represents a graph's edge with all its attributes.
 
edge(src, dst, attribute=value, ...)
 
src: source node's name
dst: destination node's name
 
All the attributes defined in the Graphviz dot language should
be supported.
 
    Attributes can be set through the dynamically generated methods:
 
 set_[attribute name], i.e. set_label, set_fontname
 
or using the instance's attributes:
 
 Edge.[attribute name], i.e. edge_instance.label, edge_instance.fontname
 
 
Method resolution order:
Edge
__builtin__.object
Common

Methods defined here:
__eq__(self, edge)
Compare two edges.
 
If the parent graph is directed, arcs linking
node A to B are considered equal and A->B != B->A
 
If the parent graph is undirected, any edge
connecting two nodes is equal to any other
edge connecting the same nodes, A->B == B->A
__init__(self, src='', dst='', obj_dict=None, **attrs)
get_destination(self)
Get the edge's destination node name.
get_source(self)
Get the edges source node name.
parse_node_ref(self, node_str)
to_string(self)
Returns a string representation of the edge in dot language.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from Common:
__get_attribute__(self, attr)
Look for default attributes for this node
__getstate__(self)
__setstate__(self, state)
create_attribute_methods(self, obj_attributes)
get(self, name)
Get an attribute value by name.
 
Given an attribute 'name' it will get its value.
There's always the possibility of using the methods:
 
    get_'name'()
    
which are defined for all the existing attributes.
get_attributes(self)
get_parent_graph(self)
get_sequence(self)
set(self, name, value)
Set an attribute value by name.
 
Given an attribute 'name' it will set its value to 'value'.
There's always the possibility of using the methods:
 
    set_'name'(value)
    
which are defined for all the existing attributes.
set_parent_graph(self, parent_graph)
set_sequence(self, seq)

 
class Error(exceptions.Exception)
    General error handling class.
 
 
Method resolution order:
Error
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, value)
__str__(self)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x1e6a40>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class Graph(__builtin__.object, Common)
    Class representing a graph in Graphviz's dot language.
 
This class implements the methods to work on a representation
of a graph in Graphviz's dot language.
 
graph(  graph_name='G', graph_type='digraph',
    strict=False, suppress_disconnected=False, attribute=value, ...)
 
graph_name:
    the graph's name
graph_type:
    can be 'graph' or 'digraph'
suppress_disconnected:
    defaults to False, which will remove from the
    graph any disconnected nodes.
simplify:
    if True it will avoid displaying equal edges, i.e.
    only one edge between two nodes. removing the
    duplicated ones.
    
All the attributes defined in the Graphviz dot language should
be supported.
 
Attributes can be set through the dynamically generated methods:
 
 set_[attribute name], i.e. set_size, set_fontname
 
or using the instance's attributes:
 
 Graph.[attribute name], i.e. graph_instance.label, graph_instance.fontname
 
 
Method resolution order:
Graph
__builtin__.object
Common

Methods defined here:
__init__(self, graph_name='G', obj_dict=None, graph_type='digraph', strict=False, suppress_disconnected=False, simplify=False, **attrs)
add_edge(self, graph_edge)
Adds an edge object to the graph.
 
It takes a edge object as its only argument and returns
None.
add_node(self, graph_node)
Adds a node object to the graph.
 
It takes a node object as its only argument and returns
None.
add_subgraph(self, sgraph)
Adds an subgraph object to the graph.
 
It takes a subgraph object as its only argument and returns
None.
get_edge(self, src, dst)
Retrieved an edge from the graph.
 
Given an edge's source and destination the corresponding
Edge instance will be returned.
 
If multiple edges exist with that source and destination,
a list of Edge instances is returned.
If only one edge exists, the instance is returned.
None is returned otherwise.
get_edge_defaults(self, **attrs)
get_edge_list(self)
Get the list of Edge instances.
 
This method returns the list of Edge instances
composing the graph.
get_edges(self)
get_graph_defaults(self, **attrs)
get_graph_type(self)
get_name(self)
Get the graph's name.
get_next_sequence_number(self)
get_node(self, name)
Retrieved a node from the graph.
 
Given a node's name the corresponding Node
instance will be returned.
 
If multiple nodes exist with that name, a list of
Node instances is returned.
If only one node exists, the instance is returned.
None is returned otherwise.
get_node_defaults(self, **attrs)
get_node_list(self)
Get the list of Node instances.
 
This method returns the list of Node instances
composing the graph.
get_nodes(self)
Return an iterator.
get_simplify(self)
Get whether to simplify or not.
 
Refer to set_simplify for more information.
get_strict(self, val)
Get graph's 'strict' mode (True, False).
 
This option is only valid for top level graphs.
get_subgraph(self, name)
Retrieved a subgraph from the graph.
 
Given a subgraph's name the corresponding
Subgraph instance will be returned.
 
If multiple subgraphs exist with the same name, a list of
Subgraph instances is returned.
If only one Subgraph exists, the instance is returned.
None is returned otherwise.
get_subgraph_list(self)
Get the list of Subgraph instances.
 
This method returns the list of Subgraph instances
in the graph.
get_subgraphs(self)
get_suppress_disconnected(self, val)
Get if suppress disconnected is set.
 
Refer to set_suppress_disconnected for more information.
get_top_graph_type(self)
get_type(self)
Get the graph's type, 'graph' or 'digraph'.
set_edge_defaults(self, **attrs)
set_graph_defaults(self, **attrs)
set_name(self, graph_name)
Set the graph's name.
set_node_defaults(self, **attrs)
set_parent_graph(self, parent_graph)
set_simplify(self, simplify)
Set whether to simplify or not.
 
If True it will avoid displaying equal edges, i.e.
only one edge between two nodes. removing the
duplicated ones.
set_strict(self, val)
Set graph to 'strict' mode.
 
This option is only valid for top level graphs.
set_suppress_disconnected(self, val)
Suppress disconnected nodes in the output graph.
 
This option will skip nodes in the graph with no        incoming or outgoing
edges. This option works also for subgraphs and has effect only in the
current graph/subgraph.
set_type(self, graph_type)
Set the graph's type, 'graph' or 'digraph'.
to_string(self)
Returns a string representation of the graph in dot language.
 
It will return the graph and all its subelements in string from.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from Common:
__get_attribute__(self, attr)
Look for default attributes for this node
__getstate__(self)
__setstate__(self, state)
create_attribute_methods(self, obj_attributes)
get(self, name)
Get an attribute value by name.
 
Given an attribute 'name' it will get its value.
There's always the possibility of using the methods:
 
    get_'name'()
    
which are defined for all the existing attributes.
get_attributes(self)
get_parent_graph(self)
get_sequence(self)
set(self, name, value)
Set an attribute value by name.
 
Given an attribute 'name' it will set its value to 'value'.
There's always the possibility of using the methods:
 
    set_'name'(value)
    
which are defined for all the existing attributes.
set_sequence(self, seq)

 
class InvocationException(exceptions.Exception)
    To indicate that a ploblem occurred while running any of the GraphViz executables.
 
 
Method resolution order:
InvocationException
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, value)
__str__(self)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x1e6a40>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class Node(__builtin__.object, Common)
    A graph node.
 
This class represents a graph's node with all its attributes.
 
node(name, attribute=value, ...)
 
name: node's name
 
All the attributes defined in the Graphviz dot language should
be supported.
 
 
Method resolution order:
Node
__builtin__.object
Common

Methods defined here:
__init__(self, name='', obj_dict=None, **attrs)
add_style(self, style)
get_name(self)
Get the node's name.
get_port(self)
Get the node's port.
set_name(self, node_name)
Set the node's name.
to_string(self)
Returns a string representation of the node in dot language.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from Common:
__get_attribute__(self, attr)
Look for default attributes for this node
__getstate__(self)
__setstate__(self, state)
create_attribute_methods(self, obj_attributes)
get(self, name)
Get an attribute value by name.
 
Given an attribute 'name' it will get its value.
There's always the possibility of using the methods:
 
    get_'name'()
    
which are defined for all the existing attributes.
get_attributes(self)
get_parent_graph(self)
get_sequence(self)
set(self, name, value)
Set an attribute value by name.
 
Given an attribute 'name' it will set its value to 'value'.
There's always the possibility of using the methods:
 
    set_'name'(value)
    
which are defined for all the existing attributes.
set_parent_graph(self, parent_graph)
set_sequence(self, seq)

 
class Subgraph(Graph)
    Class representing a subgraph in Graphviz's dot language.
 
This class implements the methods to work on a representation
of a subgraph in Graphviz's dot language.
 
subgraph(graph_name='subG', suppress_disconnected=False, attribute=value, ...)
 
graph_name:
    the subgraph's name
suppress_disconnected:
    defaults to false, which will remove from the
    subgraph any disconnected nodes.
All the attributes defined in the Graphviz dot language should
be supported.
 
Attributes can be set through the dynamically generated methods:
 
 set_[attribute name], i.e. set_size, set_fontname
 
or using the instance's attributes:
 
 Subgraph.[attribute name], i.e.
    subgraph_instance.label, subgraph_instance.fontname
 
 
Method resolution order:
Subgraph
Graph
__builtin__.object
Common

Methods defined here:
__init__(self, graph_name='', obj_dict=None, suppress_disconnected=False, simplify=False, **attrs)
# RMF: subgraph should have all the attributes of graph so it can be passed
# as a graph to all methods

Methods inherited from Graph:
add_edge(self, graph_edge)
Adds an edge object to the graph.
 
It takes a edge object as its only argument and returns
None.
add_node(self, graph_node)
Adds a node object to the graph.
 
It takes a node object as its only argument and returns
None.
add_subgraph(self, sgraph)
Adds an subgraph object to the graph.
 
It takes a subgraph object as its only argument and returns
None.
get_edge(self, src, dst)
Retrieved an edge from the graph.
 
Given an edge's source and destination the corresponding
Edge instance will be returned.
 
If multiple edges exist with that source and destination,
a list of Edge instances is returned.
If only one edge exists, the instance is returned.
None is returned otherwise.
get_edge_defaults(self, **attrs)
get_edge_list(self)
Get the list of Edge instances.
 
This method returns the list of Edge instances
composing the graph.
get_edges(self)
get_graph_defaults(self, **attrs)
get_graph_type(self)
get_name(self)
Get the graph's name.
get_next_sequence_number(self)
get_node(self, name)
Retrieved a node from the graph.
 
Given a node's name the corresponding Node
instance will be returned.
 
If multiple nodes exist with that name, a list of
Node instances is returned.
If only one node exists, the instance is returned.
None is returned otherwise.
get_node_defaults(self, **attrs)
get_node_list(self)
Get the list of Node instances.
 
This method returns the list of Node instances
composing the graph.
get_nodes(self)
Return an iterator.
get_simplify(self)
Get whether to simplify or not.
 
Refer to set_simplify for more information.
get_strict(self, val)
Get graph's 'strict' mode (True, False).
 
This option is only valid for top level graphs.
get_subgraph(self, name)
Retrieved a subgraph from the graph.
 
Given a subgraph's name the corresponding
Subgraph instance will be returned.
 
If multiple subgraphs exist with the same name, a list of
Subgraph instances is returned.
If only one Subgraph exists, the instance is returned.
None is returned otherwise.
get_subgraph_list(self)
Get the list of Subgraph instances.
 
This method returns the list of Subgraph instances
in the graph.
get_subgraphs(self)
get_suppress_disconnected(self, val)
Get if suppress disconnected is set.
 
Refer to set_suppress_disconnected for more information.
get_top_graph_type(self)
get_type(self)
Get the graph's type, 'graph' or 'digraph'.
set_edge_defaults(self, **attrs)
set_graph_defaults(self, **attrs)
set_name(self, graph_name)
Set the graph's name.
set_node_defaults(self, **attrs)
set_parent_graph(self, parent_graph)
set_simplify(self, simplify)
Set whether to simplify or not.
 
If True it will avoid displaying equal edges, i.e.
only one edge between two nodes. removing the
duplicated ones.
set_strict(self, val)
Set graph to 'strict' mode.
 
This option is only valid for top level graphs.
set_suppress_disconnected(self, val)
Suppress disconnected nodes in the output graph.
 
This option will skip nodes in the graph with no        incoming or outgoing
edges. This option works also for subgraphs and has effect only in the
current graph/subgraph.
set_type(self, graph_type)
Set the graph's type, 'graph' or 'digraph'.
to_string(self)
Returns a string representation of the graph in dot language.
 
It will return the graph and all its subelements in string from.

Data descriptors inherited from Graph:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from Common:
__get_attribute__(self, attr)
Look for default attributes for this node
__getstate__(self)
__setstate__(self, state)
create_attribute_methods(self, obj_attributes)
get(self, name)
Get an attribute value by name.
 
Given an attribute 'name' it will get its value.
There's always the possibility of using the methods:
 
    get_'name'()
    
which are defined for all the existing attributes.
get_attributes(self)
get_parent_graph(self)
get_sequence(self)
set(self, name, value)
Set an attribute value by name.
 
Given an attribute 'name' it will set its value to 'value'.
There's always the possibility of using the methods:
 
    set_'name'(value)
    
which are defined for all the existing attributes.
set_sequence(self, seq)

 
class frozendict(__builtin__.dict)
    # Extented version of ASPN's Python Cookbook Recipe:
# Frozen dictionaries.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/414283
#
# This version freezes dictionaries used as values within dictionaries.
 
 
Method resolution order:
frozendict
__builtin__.dict
__builtin__.object

Methods defined here:
__hash__(self)
__init__(self, *args, **kw)
__repr__(self)

Static methods defined here:
__new__(cls, *args, **kw)

Data descriptors defined here:
__delitem__
__dict__
dictionary for instance variables (if defined)
__setitem__
__weakref__
list of weak references to the object (if defined)
clear
pop
popitem
setdefault
update

Methods inherited from __builtin__.dict:
__cmp__(...)
x.__cmp__(y) <==> cmp(x,y)
__contains__(...)
D.__contains__(k) -> True if D has a key k, else False
__eq__(...)
x.__eq__(y) <==> x==y
__ge__(...)
x.__ge__(y) <==> x>=y
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(...)
x.__gt__(y) <==> x>y
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__lt__(...)
x.__lt__(y) <==> x<y
__ne__(...)
x.__ne__(y) <==> x!=y
copy(...)
D.copy() -> a shallow copy of D
get(...)
D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
has_key(...)
D.has_key(k) -> True if D has a key k, else False
items(...)
D.items() -> list of D's (key, value) pairs, as 2-tuples
iteritems(...)
D.iteritems() -> an iterator over the (key, value) items of D
iterkeys(...)
D.iterkeys() -> an iterator over the keys of D
itervalues(...)
D.itervalues() -> an iterator over the values of D
keys(...)
D.keys() -> list of D's keys
values(...)
D.values() -> list of D's values

Data and other attributes inherited from __builtin__.dict:
fromkeys = <built-in method fromkeys of type object at 0x35ab80>
dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.

 
Functions
       
find_graphviz()
Locate Graphviz's executables in the system.
 
Tries three methods:
 
First: Windows Registry (Windows only)
This requires Mark Hammond's pywin32 is installed.
 
Secondly: Search the path
It will look for 'dot', 'twopi' and 'neato' in all the directories
specified in the PATH environment variable.
 
Thirdly: Default install location (Windows only)
It will look for 'dot', 'twopi' and 'neato' in the default install
location under the "Program Files" directory.
 
It will return a dictionary containing the program names as keys
and their paths as values.
 
If this fails, it returns None.
graph_from_adjacency_matrix(matrix, node_prefix=u'', directed=False)
Creates a basic graph out of an adjacency matrix.
 
The matrix has to be a list of rows of values
representing an adjacency matrix.
The values can be anything: bool, int, float, as long
as they can evaluate to True or False.
graph_from_dot_data(data)
Load graph as defined by data in DOT format.
 
The data is assumed to be in DOT format. It will
be parsed and a Dot class will be returned, 
representing the graph.
graph_from_dot_file(path)
Load graph as defined by a DOT file.
 
The file is assumed to be in DOT format. It will
be loaded, parsed and a Dot class will be returned, 
representing the graph.
graph_from_edges(edge_list, node_prefix='', directed=False)
Creates a basic graph out of an edge list.
 
The edge list has to be a list of tuples representing
the nodes connected by the edge.
The values can be anything: bool, int, float, str.
 
If the graph is undirected by default, it is only
calculated from one of the symmetric halves of the matrix.
graph_from_incidence_matrix(matrix, node_prefix='', directed=False)
Creates a basic graph out of an incidence matrix.
 
The matrix has to be a list of rows of values
representing an incidence matrix.
The values can be anything: bool, int, float, as long
as they can evaluate to True or False.
needs_quotes(s)
Checks whether a string is a dot language ID.
 
It will check whether the string is solely composed
by the characters allowed in an ID or not.
If the string is one of the reserved keywords it will
need quotes too.
quote_if_necessary(s)

 
Data
        CLUSTER_ATTRIBUTES = set(['K', 'URL', 'bgcolor', 'color', 'colorscheme', 'fillcolor', ...])
EDGE_ATTRIBUTES = set(['URL', 'arrowhead', 'arrowsize', 'arrowtail', 'color', 'colorscheme', ...])
GRAPH_ATTRIBUTES = set(['Damping', 'K', 'URL', 'bb', 'bgcolor', 'center', ...])
NODE_ATTRIBUTES = set(['URL', 'color', 'colorscheme', 'comment', 'distortion', 'fillcolor', ...])
__author__ = 'Ero Carrera'
__license__ = 'MIT'
__version__ = '1.0.2'
dot_keywords = ['graph', 'subgraph', 'digraph', 'node', 'edge', 'strict']
id_re_alpha_nums = <_sre.SRE_Pattern object at 0x27ad40>
id_re_dbl_quoted = <_sre.SRE_Pattern object at 0x2a59c0>
id_re_html = <_sre.SRE_Pattern object at 0x434f98>
id_re_num = <_sre.SRE_Pattern object at 0x2a5968>
id_re_with_port = <_sre.SRE_Pattern object at 0x2a3560>

 
Author
        Ero Carrera