1 //=======================================================================
2 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
3 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
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>
12 #include <boost/graph/adjacency_list.hpp>
13 #include <boost/graph/graph_utility.hpp>
29 removing edge (0,2) and (3, 2)
37 using namespace boost
;
39 typedef adjacency_list
<vecS
, vecS
, directedS
> Graph
;
45 typedef std::pair
<std::size_t,std::size_t> Edge
;
46 Edge edges
[6] = { Edge(0,3), Edge(0,2), Edge(0, 3),
51 #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
52 // VC++ can't handle iterator constructor
54 for (std::size_t j
= 0; j
< 6; ++j
)
55 add_edge(edges
[j
].first
, edges
[j
].second
, g
);
57 Graph
g(edges
, edges
+ 6, 4);
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
));