diff --git a/include/CXXGraph/Graph/Graph_impl.hpp b/include/CXXGraph/Graph/Graph_impl.hpp index 1b072fe58..d6c221c04 100644 --- a/include/CXXGraph/Graph/Graph_impl.hpp +++ b/include/CXXGraph/Graph/Graph_impl.hpp @@ -97,7 +97,10 @@ void Graph::addEdge(const Edge *edge) { template void Graph::addEdge(shared> edge) { - this->edgeSet.insert(edge); + auto [it, inserted] = edgeSet.insert(edge); + if (!inserted) { + return; + } auto &[from, to] = edge->getNodePair();