1// (C) Copyright Jeremy Siek 2004
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6#include <iostream>
7#include <boost/graph/adjacency_list.hpp>
8#include <boost/cstdlib.hpp>
9#include <boost/detail/lightweight_test.hpp>
10
11struct edge_prop
12{
13 int weight;
14};
15
16int main(int, char*[])
17{
18 {
19 typedef boost::adjacency_list< boost::vecS, boost::vecS,
20 boost::bidirectionalS, boost::no_property, edge_prop >
21 graph;
22 typedef boost::graph_traits< graph >::edge_descriptor edge;
23
24 graph g(2);
25
26 edge_prop p = { .weight: 42 };
27 edge e;
28 bool b;
29 boost::tie(t0&: e, t1&: b) = add_edge(u: 0, v: 1, p, g_&: g);
30 BOOST_TEST(num_edges(g) == 1);
31 BOOST_TEST(g[e].weight == 42);
32 remove_edge(e, g_&: g);
33 BOOST_TEST(num_edges(g) == 0);
34 }
35 {
36 typedef boost::adjacency_list< boost::vecS, boost::vecS,
37 boost::bidirectionalS >
38 graph;
39 typedef boost::graph_traits< graph >::edge_descriptor edge;
40
41 graph g(2);
42
43 edge e;
44 bool b;
45 boost::tie(t0&: e, t1&: b) = add_edge(u: 0, v: 1, g_&: g);
46 BOOST_TEST(num_edges(g) == 1);
47 remove_edge(e, g_&: g);
48 BOOST_TEST(num_edges(g) == 0);
49 }
50 return boost::report_errors();
51}
52

source code of boost/libs/graph/test/bidir_remove_edge.cpp