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;