Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions include/boost/graph/detail/adjacency_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2058,13 +2058,17 @@ namespace boost {
{
typename EdgeList::iterator ei = el.begin(), e_end = el.end();
while (ei != e_end) {
typename EdgeList::value_type ce = *ei;
++ei;
if (ce.get_target() > u) {
if (ei->get_target() > u) {
typename EdgeList::value_type ce = *ei;
++ei;
el.erase(ce);
--ce.get_target();
el.insert(ce);
}
else
{
++ei;
}
}
}
} // namespace detail
Expand Down
1 change: 1 addition & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ test-suite graph_test :
[ run strong_components_test.cpp ]
[ run find_flow_cost_bundled_properties_and_named_params_test.cpp ../../test/build//boost_unit_test_framework/<link>static ]
[ run max_flow_algorithms_bundled_properties_and_named_params.cpp ../../test/build//boost_unit_test_framework/<link>static ]
[ run remove_vertex.cpp ]
;

# Run SDB tests only when -sSDB= is set.
Expand Down
57 changes: 57 additions & 0 deletions test/remove_vertex.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//=======================================================================
// Copyright 2018
// Authors: Rasmus Ahlberg
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================

#include <iostream>

#include <boost/graph/adjacency_list.hpp>

#include <boost/test/minimal.hpp>

int test_main(int argc, char* argv[])
{
typedef int Vertex;
typedef int Edge;

typedef boost::adjacency_list<boost::setS, // Container type for edges
boost::vecS, // Container type for vertices
boost::directedS, // Param for
// directed/undirected/bidirectional
// graph
Vertex, // Type for the vertices
Edge // Type for the edges
> Graph_t;

typedef Graph_t::edge_descriptor EdgeDesc;


Graph_t m_graph;

auto v1 = boost::add_vertex(m_graph);
auto v2 = boost::add_vertex(m_graph);
auto v3 = boost::add_vertex(m_graph);

EdgeDesc ed1;
bool inserted1;

boost::tie(ed1, inserted1) = boost::add_edge(v3, v1, m_graph);

BOOST_REQUIRE(inserted1);

static const int EDGE_VAL = 1234;

m_graph[ed1] = EDGE_VAL;

boost::remove_vertex(v2, m_graph);

std::cout << "ed1 " << m_graph[ed1] << std::endl;

BOOST_REQUIRE(m_graph[ed1] == EDGE_VAL);

return 0;
}