Skip to content

Refactor addEdge - removed duplicate insert#535

Merged
ZigRazor merged 1 commit intoZigRazor:masterfrom
fork-of-sahil:bug/removed-duplicate-insert-addEdge
Sep 30, 2025
Merged

Refactor addEdge - removed duplicate insert#535
ZigRazor merged 1 commit intoZigRazor:masterfrom
fork-of-sahil:bug/removed-duplicate-insert-addEdge

Conversation

@sahilkamate03
Copy link
Copy Markdown
Contributor

Title:
Fix duplicated insert in addEdge function (#533)

Related Issue:
Closes #533

Description:
This PR fixes a duplicated insert call in the addEdge function of Graph. Previously, the function was calling edgeSet.insert(edge) twice, which is unnecessary.

The changes include:

Removed the redundant edgeSet.insert(edge) call.

Refactored duplicate detection to use the return value of insert() for cleaner and more efficient code.

Maintained proper updates to cached adjacency lists for both directed and undirected edges.

Code Reference:
Original line: Graph_impl.hpp#L105-L105

@ZigRazor ZigRazor merged commit 87251e2 into ZigRazor:master Sep 30, 2025
10 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicated Insert in addEdge function

2 participants