API Reference for Enthought Tool Suite 2.7.1
Graph algorithms A graph is represented by a dictionary which represents the adjacency relation, where node a has an arc to node b iff `b in d[a]'.
Returns the transitive closure of the graph. If sorted is True then the successor nodes will be sorted into topological order.
Maps function f over the nodes in graph.
>>> map(str, { 1:[2,3] })
{'1': ['2', '3']}
Return the subgraph of the given graph reachable from the given nodes.
>>> reachable_graph({'a':'bc', 'b':'c' }, 'a')
{'a': 'bc', 'b': 'c'}
>>> reachable_graph({'a':'bc', 'b':'c' }, 'b')
{'b': 'c'}
>>> reachable_graph({'a':'bc', 'b':'c' }, 'c')
{}
Returns the reverse of a graph, that is the graph made when all of the edges are reversed.
Returns the nodes in the graph in topological order.
| Local name | Refers to |
|---|---|
| __builtin__ | __builtin__ |
| chain | itertools.chain |
| flatten | enthought.util.cbook.flatten |
| map_items | enthought.util.dict.map_items |
| map_values | enthought.util.dict.map_values |
Copyright © 2002-2008 Enthought, Inc.