Skip to content

fix: keep orphan nodes after removeEdge (empty erase guard) - #609

Merged
ZigRazor merged 2 commits into
ZigRazor:masterfrom
rachelwelchio:fix/remove-edge-orphan-nodes-497
Sep 10, 2026
Merged

fix: keep orphan nodes after removeEdge (empty erase guard)#609
ZigRazor merged 2 commits into
ZigRazor:masterfrom
rachelwelchio:fix/remove-edge-orphan-nodes-497

Conversation

@rachelwelchio

Copy link
Copy Markdown
Contributor

Summary

Fixes removeEdge leaving the graph inconsistent (#497).

  • Guard edgeSet.erase so we never erase an end iterator when find misses after an optional unwrap.
  • When an endpoint disappears from both adjacency lists, insert it into isolatedNodesSet (same idea as Hypergraph::unregisterEdgeFromIncidence_).
  • On addEdge, drop endpoints from isolatedNodesSet so reconnecting a former orphan stays consistent.
  • Add a regression test covering the directed weighted single-edge repro from the issue.

Fixes #497

Signed-off-by: rachelwelchio <rachelwelchio@users.noreply.github.com>
Signed-off-by: rachelwelchio <rachelwelchio@users.noreply.github.com>
@ZigRazor
ZigRazor merged commit 7c70406 into ZigRazor:master Sep 10, 2026
32 of 88 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.

Remove edge leaves graph object in an inconsistent state segfault

2 participants