module documentation
Graph algorithms. A graph is represented by a dictionary which represents the adjacency relation, where node ``a`` has an arc to node ``b`` if and only if ``b in d[a]``.
Function | closure |
Returns the transitive closure of the graph. If sorted is True then the successor nodes will be sorted into topological order. |
Function | eq |
Undocumented |
Function | map |
Maps function f over the nodes in graph. |
Function | reachable |
Return the subgraph of the given graph reachable from the given nodes. |
Function | reverse |
Returns the reverse of a graph, that is the graph made when all of the edges are reversed. |
Returns the transitive closure of the graph. If sorted is True then the successor nodes will be sorted into topological order.
Return the subgraph of the given graph reachable from the given nodes. >>> sorted(reachable_graph({'a':'bc', 'b':'c' }, 'a').items()) [('a', 'bc'), ('b', 'c')] >>> reachable_graph({'a':'bc', 'b':'c' }, 'b') {'b': 'c'} >>> reachable_graph({'a':'bc', 'b':'c' }, 'c') {}