mirror of
https://github.com/boostorg/graph.git
synced 2026-01-30 20:02:12 +00:00
Started documenting Python bindings
libs/graph/src/python/basic_graph.cpp, libs/graph/src/python/basic_graph.hpp:
- Allow one to build a graph from anything that looks like a Python list or
tuple.
[SVN r28324]
This commit is contained in:
14
example/python/breadth_first_search.py
Normal file
14
example/python/breadth_first_search.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from bgl import *
|
||||
|
||||
class bfs_print_discover_visitor(Graph.BFSVisitor):
|
||||
def discover_vertex(self, u, g):
|
||||
print "Discovered vertex ",
|
||||
print u
|
||||
|
||||
g = Graph((("r", "s"), ("r", "v"), ("s", "w"), ("w", "r"), ("w", "t"), ("w", "x"), ("x", "t"), ("t", "u"), ("x", "y"), ("u", "y")))
|
||||
|
||||
iter = g.vertices.__iter__()
|
||||
iter.next()
|
||||
s = iter.next()
|
||||
breadth_first_search(g, s, visitor=bfs_print_discover_visitor())
|
||||
|
||||
Reference in New Issue
Block a user