1 | #include <iostream>
|
---|
2 | #include <vector>
|
---|
3 |
|
---|
4 | #include <boost/graph/adjacency_list.hpp>
|
---|
5 | #include <boost/graph/biconnected_components.hpp>
|
---|
6 |
|
---|
7 | using namespace std;
|
---|
8 | using namespace boost;
|
---|
9 |
|
---|
10 | typedef adjacency_list<vecS,vecS,undirectedS> Graph;
|
---|
11 | typedef graph_traits<Graph>:: vertex_descriptor Vertex;
|
---|
12 |
|
---|
13 |
|
---|
14 | int main() {
|
---|
15 | Graph g(4);
|
---|
16 | add_edge(2,3,g);
|
---|
17 | add_edge(1,3,g);
|
---|
18 | add_edge(1,2,g);
|
---|
19 | add_edge(0,1,g);
|
---|
20 |
|
---|
21 | vector<Vertex> dtm(4);
|
---|
22 | vector<Vertex> low(4);
|
---|
23 | vector<Vertex> p(4);
|
---|
24 | biconnected_components(g, dummy_property_map(),
|
---|
25 | discover_time_map(&dtm[0])
|
---|
26 | .lowpoint_map(&low[0])
|
---|
27 | . predecessor_map(&p[0]) );
|
---|
28 |
|
---|
29 | for(Vertex v=0; v<4; ++v) {
|
---|
30 | cout << "vertex: " << v << " - discover time: " << dtm[v] << " - lowpoint: " << low[v] << " - parent: " << p[v] << "\n";
|
---|
31 | }
|
---|
32 | return 0;
|
---|
33 | }
|
---|
34 |
|
---|