From b19eda3a484ed95f74165f22cec701707d4fa2c2 Mon Sep 17 00:00:00 2001 From: dmatetelki Date: Wed, 14 May 2014 10:34:52 +0200 Subject: [PATCH] fixing the removal of edges --- lib/graph/graph.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/graph/graph.hpp b/lib/graph/graph.hpp index 7b786d0..14aa8c4 100644 --- a/lib/graph/graph.hpp +++ b/lib/graph/graph.hpp @@ -371,9 +371,11 @@ inline void Graph::Vertex::removeEdge(const_reference destination, const_w template inline void Graph::Vertex::removeAllEdgesTo(const_reference destination) { - std::remove_if(m_edges.begin(), m_edges.end(), - [&destination](const EdgeTo& e) - { return *e.m_destination == destination; }); + m_edges.erase( + std::remove_if(m_edges.begin(), m_edges.end(), + [&destination](const EdgeTo& e) + { return *e.m_destination == destination; }), + m_edges.end()); } template @@ -472,7 +474,7 @@ inline bool Graph::removeAllEdges(const_reference source, const_reference return false; (*source_it).removeAllEdgesTo(destination); - if (m_directed) + if (!m_directed) (*destination_it).removeAllEdgesTo(source); return true;