// Copyright 2003, Trustees of Indiana University // Please see the license in the file ../LICENSE using System; using GCollections; public class printing_visitor : Visitor { public void initialize_vertex(Vertex u, Graph g) { Console.WriteLine("initialize {0} in {1}", u, g); } public void discover_vertex(Vertex u, Graph g) { Console.WriteLine("discover {0} in {1}", u, g); } public void finish_vertex(Vertex u, Graph g) { Console.WriteLine("finish {0} in {1}", u, g); } public void examine_edge(Edge e, Graph g) { Console.WriteLine("examine {0} in {1}", e, g); } public void tree_edge(Edge e, Graph g) { Console.WriteLine("tree {0} in {1}", e, g); } public void non_tree_edge(Edge e, Graph g) { Console.WriteLine("nontree {0} in {1}", e, g); } public void gray_target(Edge e, Graph g) { Console.WriteLine("gray target {0} in {1}", e, g); } public void black_target(Edge e, Graph g) { Console.WriteLine("black target {0} in {1}", e, g); } } public class bfs_test { public static int Main(string[] args) { adjacency_list g = new adjacency_list(); g.add_vertex(3); g.add_vertex(4); g.add_vertex(5); g.add_vertex(6); g.add_edge(3, 6); g.add_edge(3, 5); g.add_edge(4, 5); g.add_edge(6, 4); g.add_edge(4, 3); hash_property_map color = new hash_property_map(); breadth_first_search.go,IEnumerable,IEnumerable >,printing_visitor >, hash_property_map >( g, 3, new printing_visitor< adjacency_list, int, adj_list_edge >(), color); return 0; } }