Skip to content

Commit 87251e2

Browse files
Refactor addEdge - removed duplicate insert (#535)
1 parent 15eaeab commit 87251e2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

include/CXXGraph/Graph/Graph_impl.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ void Graph<T>::addEdge(const Edge<T> *edge) {
9797

9898
template <typename T>
9999
void Graph<T>::addEdge(shared<const Edge<T>> edge) {
100-
this->edgeSet.insert(edge);
100+
auto [it, inserted] = edgeSet.insert(edge);
101+
if (!inserted) {
102+
return;
103+
}
101104

102105
auto &[from, to] = edge->getNodePair();
103106

0 commit comments

Comments
 (0)