mirror of
https://github.com/boostorg/graph.git
synced 2025-05-10 07:23:58 +00:00
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]
16 lines
448 B
Python
16 lines
448 B
Python
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")), "label")
|
|
|
|
|
|
breadth_first_search(g, s, visitor=bfs_print_discover_visitor())
|
|
|