Improve vacpp support.
[boost.git] / boost / libs / graph / example / remove_edge_if_dir.cpp
blob6b6f76edbf35cb803fc428a14a5ca04ed19006e5
1 //=======================================================================
2 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
3 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //=======================================================================
10 #include <boost/config.hpp>
11 #include <iostream>
12 #include <boost/graph/adjacency_list.hpp>
13 #include <boost/graph/graph_utility.hpp>
16 Sample output:
18 original graph:
19 0 --> 3 2 3
20 1 --> 3
21 2 --> 0
22 3 --> 2
24 removing edges (0,3)
25 0 --> 2
26 1 --> 3
27 2 --> 0
28 3 --> 2
29 removing edge (0,2) and (3, 2)
30 0 -->
31 1 --> 3
32 2 --> 0
33 3 -->
37 using namespace boost;
39 typedef adjacency_list<vecS, vecS, directedS> Graph;
42 int
43 main()
45 typedef std::pair<std::size_t,std::size_t> Edge;
46 Edge edges[6] = { Edge(0,3), Edge(0,2), Edge(0, 3),
47 Edge(1,3),
48 Edge(2, 0),
49 Edge(3, 2) };
51 #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
52 // VC++ can't handle iterator constructor
53 Graph g(4);
54 for (std::size_t j = 0; j < 6; ++j)
55 add_edge(edges[j].first, edges[j].second, g);
56 #else
57 Graph g(edges, edges + 6, 4);
58 #endif
60 std::cout << "original graph:" << std::endl;
61 print_graph(g, get(vertex_index, g));
62 std::cout << std::endl;
64 std::cout << "removing edges (0,3)" << std::endl;
65 remove_out_edge_if(vertex(0,g), incident_to(vertex(3,g), g), g);
66 print_graph(g, get(vertex_index, g));
68 std::cout << "removing edge (0,2) and (3, 2)" << std::endl;
69 remove_edge_if(incident_to(vertex(2,g), g), g);
70 print_graph(g, get(vertex_index, g));
72 return 0;