mirror of
https://github.com/boostorg/graph.git
synced 2026-01-30 20:02:12 +00:00
doc/*: Document Python bindings
src/python/basic_graph.cpp src/python/basic_graph.hpp:
- Add ability to record the names of vertices input via the adjacency list
reader.
example/python/breadth_first_search.py: Building a better example
[SVN r28350]
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
from bgl import *
|
||||
|
||||
class bfs_print_discover_visitor(Graph.BFSVisitor):
|
||||
def bfs_print_discover_visitor(self, dtime_map):
|
||||
Graph.BFSVisitor.__init__(self)
|
||||
|
||||
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")))
|
||||
g = Graph((("r", "s"), ("r", "v"), ("s", "w"), ("w", "r"), ("w", "t"), ("w", "x"), ("x", "t"), ("t", "u"), ("x", "y"), ("u", "y")), "label")
|
||||
|
||||
|
||||
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