A directed graph abstraction with labeled edges.
|
__init__(self,
nodes=[ ] )
Initializes a new Graph object. |
source code
|
|
|
__eq__(self,
g)
Returns true if g is equal to this graph. |
source code
|
|
|
__ne__(self,
g)
Returns true if g is not equal to this graph. |
source code
|
|
|
__repr__(self)
Returns an unique string representation of this graph. |
source code
|
|
|
__str__(self)
Returns a concise string description of this graph. |
source code
|
|
|
add_node(self,
node)
Adds a node to this graph. |
source code
|
|
|
add_edge(self,
source,
to,
label=None)
Adds an edge to this graph. |
source code
|
|
|
child_edges(self,
parent)
Returns a list of (child, label) pairs for parent. |
source code
|
|
|
children(self,
parent)
Returns a list of unique children for parent. |
source code
|
|
|
edges(self,
label)
Returns a list of all the edges with this label. |
source code
|
|
|
labels(self)
Returns a list of all the edge labels in this graph. |
source code
|
|
|
nodes(self)
Returns a list of the nodes in this graph. |
source code
|
|
|
parent_edges(self,
child)
Returns a list of (parent, label) pairs for child. |
source code
|
|
|
parents(self,
child)
Returns a list of unique parents for child. |
source code
|
|
|
remove_node(self,
node)
Removes node and all edges connected to it. |
source code
|
|
|
|