A simple example showing how to use the graph interface in Python.
14 for i
in range(0, 10):
16 vs.append(g.add_vertex(ps[-1]))
17 g.add_edge(vs[0], vs[1])
18 g.add_edge(vs[1], vs[2])
25 print(
"Oh well, no altgraph")
30 matplotlib.use(
"macosx")
31 import matplotlib.pyplot
42 print(
"networkx not fully installed")
50 print(
"oh well, something not working with graphviz")
54 for n
in g.get_in_neighbors(8):
55 print(g.get_vertex_name(n).get_name())