| 1 | #include <iostream>
|
|---|
| 2 | #include <boost/graph/adjacency_list.hpp>
|
|---|
| 3 | #include <boost/graph/edge_connectivity.hpp>
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 | using namespace boost;
|
|---|
| 7 | typedef adjacency_list<vecS,vecS,bidirectionalS> MyGraph;
|
|---|
| 8 |
|
|---|
| 9 | int main()
|
|---|
| 10 | {
|
|---|
| 11 | typedef graph_traits < MyGraph >::vertex_descriptor vertex_descriptor;
|
|---|
| 12 | typedef graph_traits < MyGraph >::edge_descriptor edge_descriptor;
|
|---|
| 13 |
|
|---|
| 14 | MyGraph g;
|
|---|
| 15 |
|
|---|
| 16 | vertex_descriptor v1 = add_vertex(g);
|
|---|
| 17 | vertex_descriptor v2 = add_vertex(g);
|
|---|
| 18 | vertex_descriptor v3 = add_vertex(g);
|
|---|
| 19 |
|
|---|
| 20 | add_edge(v1, v2, g);
|
|---|
| 21 | add_edge(v2, v3, g);
|
|---|
| 22 |
|
|---|
| 23 | std::cout << "Path of " << num_vertices(g) << " vertices and " << num_edges(g) << " edges.\n";
|
|---|
| 24 | std::vector < edge_descriptor > disconnecting_set;
|
|---|
| 25 |
|
|---|
| 26 | std::cout << "The edge connectivity is "
|
|---|
| 27 | << edge_connectivity(g, std::back_inserter(disconnecting_set))
|
|---|
| 28 | << "." << std::endl;
|
|---|
| 29 |
|
|---|
| 30 | add_edge(v2, v1, g);
|
|---|
| 31 | std::cout << "Added edge (" << v2 << "," << v1 << "): now there are " << num_edges(g) << " edges.\n";
|
|---|
| 32 |
|
|---|
| 33 | std::cout << "The edge connectivity becomes "
|
|---|
| 34 | << edge_connectivity(g, std::back_inserter(disconnecting_set))
|
|---|
| 35 | << "." << std::endl;
|
|---|
| 36 | return EXIT_SUCCESS;
|
|---|
| 37 | }
|
|---|