A simple example showing how to use the graph interface in Python.
4 from __future__
import print_function
15 for i
in range(0, 10):
17 vs.append(g.add_vertex(ps[-1]))
18 g.add_edge(vs[0], vs[1])
19 g.add_edge(vs[1], vs[2])
26 print(
"Oh well, no altgraph")
31 matplotlib.use(
"macosx")
32 import matplotlib.pyplot
43 print(
"networkx not fully installed")
51 print(
"oh well, something not working with graphviz")
55 for n
in g.get_in_neighbors(8):
56 print(g.get_vertex_name(n).get_name())