Home  Trees  Indices  Help 



Represent a directed graph.




































Inherited from 


Inherited from 

x.__init__(...) initializes x; see help(type(x)) for signature



Add an edge going from head to tail. head : head node tail : tail node 
Add full connectivity from a group of nodes to another one. Return a list of lists of edges, one for each node in 'from_nodes'. Example: create a twolayer graph with full connectivity. >>> g = Graph() >>> layer1 = g.add_nodes(10) >>> layer2 = g.add_nodes(5) >>> g.add_full_connectivity(layer1, layer2) 

Add many nodes at once. data  number of nodes to add or sequence of data values, one for each new node 
Add a tree to the graph. The tree is specified with a nested list of tuple, in a LISPlike notation. The values specified in the list become the values of the single nodes. Return an equivalent nested list with the nodes instead of the values. Example: >>> a=b=c=d=e=None >>> g.add_tree( (a, b, (c, d ,e)) ) corresponds to this tree structure, with all node values set to None: a / b c / d e 
Return a list of nodes in some Breadth First order starting from a root node. If defined, visit_fct is applied on each visited node. Note the returned list does not have to contain all nodes in the graph, but only the ones reachable from the root. 
Return a list of lists containing the nodes of all connected components of the graph. 
Return a list of nodes in some Depth First order starting from a root node. If defined, visit_fct is applied on each visited node. The returned list does not have to contain all nodes in the graph, but only the ones reachable from the root. 
Return True if the graph is weakly connected. 


Perform a topological sort of the nodes. If the graph has a cycle, throw a GraphTopologicalException with the list of successfully ordered nodes. 
Perform Breadth First sort. This function is identical to bfs, but the sort is performed on the equivalent undirected version of the graph. 
Perform Depth First sort. This function is identical to dfs, but the sort is performed on the equivalent undirected version of the graph. 
Home  Trees  Indices  Help 


Generated by Epydoc 3.0.1 on Thu Oct 4 14:38:21 2012  http://epydoc.sourceforge.net 