Digraph class.
Digraphs are built of nodes and directed edges.
|
|
iterator
|
__getitem__(self,
node)
Return a iterator passing through all neighbors of the given node. |
|
|
iterator
|
__iter__(self)
Return a iterator passing through all nodes in the digraph. |
|
|
number
|
__len__(self)
Return the order of the digraph when requested by len(). |
|
|
string
|
__str__(self)
Return a string representing the digraph when requested by str() (or
print). |
|
|
|
add_edge(self,
u,
v,
wt=1,
label='
' ,
attrs=[ ] )
Add an directed edge (u,v) to the graph connecting nodes u to v. |
|
|
|
|
|
add_graph(self,
graph)
Add other graph to the graph. |
|
|
|
add_node(self,
node,
attrs=[ ] )
Add given node to the graph. |
|
|
|
|
|
add_nodes(self,
nodelist)
Add given nodes to the graph. |
|
|
|
|
|
complete(self)
Make the graph a complete graph. |
|
|
|
del_edge(self,
u,
v)
Remove an directed edge (u, v) from the graph. |
|
|
|
del_node(self,
node)
Remove a node from the graph. |
|
|
list
|
edges(self)
Return all edges in the graph. |
|
|
list
|
|
string
|
|
number
|
|
list
|
|
boolean
|
has_edge(self,
u,
v)
Return whether an edge between nodes u and v exists. |
|
|
boolean
|
has_node(self,
node)
Return whether the requested node exists. |
|
|
list
|
incidents(self,
node)
Return all nodes that are incident to the given node. |
|
|
graph
|
inverse(self)
Return the inverse of the graph. |
|
|
list
|
neighbors(self,
node)
Return all nodes that are directly accessible from given node. |
|
|
number
|
node_degree(self,
node)
Return the degree of the given node. |
|
|
number
|
node_order(self,
node)
Return the order of the given node. |
|
|
list
|
nodes(self)
Return node list. |
|
|
digraph
|
reverse(self)
Generate the reverse of a directed graph. |
|
|
|
|
|
|
iterator
|
traversal(self,
node,
order=' pre ' )
Graph traversal iterator. |
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|