mirror of
https://github.com/boostorg/graph.git
synced 2025-05-09 23:14:00 +00:00
Merge branch 'csr-example' of https://github.com/deinst/graph into develop
Fixed Conflicts: example/Jamfile.v2
This commit is contained in:
commit
338f917cfb
@ -39,6 +39,7 @@ run connected_components.cpp ;
|
||||
run connected-components.cpp ;
|
||||
run container_gen.cpp ;
|
||||
run copy-example.cpp ;
|
||||
run csr-example.cpp ;
|
||||
run cuthill_mckee_ordering.cpp ;
|
||||
run cycle_canceling_example.cpp ;
|
||||
run cycle_ratio_example.cpp ;
|
||||
@ -226,4 +227,3 @@ explicit girth ;
|
||||
# does not compile:
|
||||
#
|
||||
# run bucket_sorter.cpp ;
|
||||
# run csr-example.cpp ;
|
||||
|
@ -44,13 +44,13 @@ int main()
|
||||
"http://www.boost.org/libs/graph/doc/using_adjacency_list.html",
|
||||
};
|
||||
|
||||
E the_edges[] = { E(0, 1), E(0, 2), E(0, 3), E(1, 0), E(1, 3), E(1, 5),
|
||||
E(2, 0), E(2, 5), E(3, 1), E(3, 4), E(4, 1), E(5, 0),
|
||||
E the_edges[] = { E(0, 1), E(0, 2), E(0, 3), E(1, 0), E(1, 3), E(1, 5),
|
||||
E(2, 0), E(2, 5), E(3, 1), E(3, 4), E(4, 1), E(5, 0),
|
||||
E(5, 2) };
|
||||
|
||||
typedef compressed_sparse_row_graph<directedS, WebPage> WebGraph;
|
||||
WebGraph g(boost::edges_are_sorted, &the_edges[0], &the_edges[0] + sizeof(the_edges)/sizeof(E), 6);
|
||||
|
||||
|
||||
// Set the URLs of each vertex
|
||||
int index = 0;
|
||||
BGL_FORALL_VERTICES(v, g, WebGraph)
|
||||
@ -59,13 +59,13 @@ int main()
|
||||
// Output each of the links
|
||||
std::cout << "The web graph:" << std::endl;
|
||||
BGL_FORALL_EDGES(e, g, WebGraph)
|
||||
std::cout << " " << g[source(e, g)].url << " -> " << g[target(e, g)].url
|
||||
std::cout << " " << g[source(e, g)].url << " -> " << g[target(e, g)].url
|
||||
<< std::endl;
|
||||
|
||||
|
||||
// Output the graph in DOT format
|
||||
dynamic_properties dp;
|
||||
dp.property("label", get(&WebPage::url, g));
|
||||
std::ofstream out("web-graph.dot");
|
||||
write_graphviz(out, g, dp, std::string(), get(vertex_index, g));
|
||||
write_graphviz_dp(out, g, dp, std::string(), get(vertex_index, g));
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user