From 5e537cd7413a4576e8cec6e1cd0b9271fa17fc99 Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Tue, 10 Jul 2001 14:54:58 +0000 Subject: [PATCH] updated a comment in kevin_bacon [SVN r10582] --- example/cuthill_mckee_ordering.cpp | 50 ++++++++++++++++++------------ example/kevin_bacon.cpp | 4 +-- example/regression.cfg | 8 ++--- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/example/cuthill_mckee_ordering.cpp b/example/cuthill_mckee_ordering.cpp index 1e7f9e95..8d178588 100644 --- a/example/cuthill_mckee_ordering.cpp +++ b/example/cuthill_mckee_ordering.cpp @@ -31,25 +31,25 @@ #include #include - /* - Sample Output - degree: - 2 4 3 4 3 4 4 2 1 1 - Reverse Cuthill-McKee ordering starting at :6 +/* + Sample Output + original bandwidth: 8 + Reverse Cuthill-McKee ordering starting at: 6 8 3 0 9 2 5 1 4 7 6 - Reverse Cuthill-McKee ordering starting at :0 + bandwidth: 4 + Reverse Cuthill-McKee ordering starting at: 0 9 1 4 6 7 2 8 5 3 0 - Reverse Cuthill-McKee ordering: //choose vertex 9 + bandwidth: 4 + Reverse Cuthill-McKee ordering: 0 8 5 7 3 6 4 2 1 9 - + bandwidth: 4 */ int main(int , char* []) { using namespace boost; using namespace std; - identity_property_map id; typedef adjacency_list > > Graph; typedef graph_traits::vertex_descriptor Vertex; typedef graph_traits::vertices_size_type size_type; @@ -80,9 +80,13 @@ int main(int , char* []) for (boost::tie(ui, ui_end) = vertices(G); ui != ui_end; ++ui) deg[*ui] = degree(*ui, G); + property_map::type + index_map = get(vertex_index, G); + std::cout << "original bandwidth: " << bandwidth(G) << std::endl; - std::vector inv_perm(num_vertices(G)), perm(num_vertices(G)); + std::vector inv_perm(num_vertices(G)); + std::vector perm(num_vertices(G)); { Vertex s = vertex(6, G); //reverse cuthill_mckee_ordering @@ -92,12 +96,14 @@ int main(int , char* []) cout << " "; for (std::vector::const_iterator i = inv_perm.begin(); i != inv_perm.end(); ++i) - cout << id[*i] << " "; + cout << index_map[*i] << " "; cout << endl; for (size_type c = 0; c != inv_perm.size(); ++c) - perm[inv_perm[c]] = c; - std::cout << " bandwidth: " << bandwidth(G, &perm[0]) << std::endl; + perm[index_map[inv_perm[c]]] = c; + std::cout << " bandwidth: " + << bandwidth(G, make_iterator_property_map(&perm[0], index_map)) + << std::endl; } { Vertex s = vertex(0, G); @@ -108,12 +114,14 @@ int main(int , char* []) cout << " "; for (std::vector::const_iterator i=inv_perm.begin(); i != inv_perm.end(); ++i) - cout << id[*i] << " "; + cout << index_map[*i] << " "; cout << endl; for (size_type c = 0; c != inv_perm.size(); ++c) - perm[inv_perm[c]] = c; - std::cout << " bandwidth: " << bandwidth(G, &perm[0]) << std::endl; + perm[index_map[inv_perm[c]]] = c; + std::cout << " bandwidth: " + << bandwidth(G, make_iterator_property_map(&perm[0], index_map)) + << std::endl; } { @@ -125,12 +133,14 @@ int main(int , char* []) cout << " "; for (std::vector::const_iterator i=inv_perm.begin(); i != inv_perm.end(); ++i) - cout << id[*i] << " "; + cout << index_map[*i] << " "; cout << endl; for (size_type c = 0; c != inv_perm.size(); ++c) - perm[inv_perm[c]] = c; - std::cout << " bandwidth: " << bandwidth(G, &perm[0]) << std::endl; + perm[index_map[inv_perm[c]]] = c; + std::cout << " bandwidth: " + << bandwidth(G, make_iterator_property_map(&perm[0], index_map)) + << std::endl; } return 0; } diff --git a/example/kevin_bacon.cpp b/example/kevin_bacon.cpp index 7089efda..937e1093 100644 --- a/example/kevin_bacon.cpp +++ b/example/kevin_bacon.cpp @@ -112,8 +112,8 @@ main() } { - // Use Dijkstra's shortest paths algorithm to calculate the Bacon - // numbers of all the actors in our graph. + // Use the BFS algorithm to calculate the Bacon numbers of all the + // actors in our graph. std::vector bacon_number( num_vertices(g) ); std::vector predecessor( num_vertices(g) ); diff --git a/example/regression.cfg b/example/regression.cfg index de029d5a..e20f1662 100644 --- a/example/regression.cfg +++ b/example/regression.cfg @@ -5,9 +5,12 @@ // // Please keep the entries ordered alphabetically by the test's file name. +compile libs/graph/example/quick_tour.cpp +compile libs/graph/example/property_iterator.cpp +compile libs/graph/example/fibonacci_heap.cpp +compile libs/graph/example/bellman_ford.cpp compile libs/graph/example/adjacency_list.cpp compile libs/graph/example/adjacency_matrix.cpp -compile libs/graph/example/bellman_ford.cpp compile libs/graph/example/bfs.cpp compile libs/graph/example/bfs_basics.cpp compile libs/graph/example/boost_web_graph.cpp @@ -30,7 +33,6 @@ compile libs/graph/example/edmunds_karp_max_flow.cpp compile libs/graph/example/exterior_properties.cpp compile libs/graph/example/exterior_property_map.cpp compile libs/graph/example/family_tree.cpp -compile libs/graph/example/fibonacci_heap.cpp compile libs/graph/example/file_dependencies.cpp compile libs/graph/example/filtered_graph.cpp compile libs/graph/example/gerdemann.cpp @@ -48,8 +50,6 @@ compile libs/graph/example/min_max_paths.cpp compile libs/graph/example/modify_graph.cpp compile libs/graph/example/ordered_out_edges.cpp compile libs/graph/example/prim.cpp -compile libs/graph/example/property_iterator.cpp -compile libs/graph/example/quick_tour.cpp compile libs/graph/example/remove_edge_if_bidir.cpp compile libs/graph/example/remove_edge_if_dir.cpp compile libs/graph/example/remove_edge_if_undir.cpp