Skip to content

Fix: labeled_graph pointer specialization remove_vertex not removing label#464

Draft
Becheler wants to merge 6 commits intoboostorg:developfrom
Becheler:fix/labeled_graph_remove
Draft

Fix: labeled_graph pointer specialization remove_vertex not removing label#464
Becheler wants to merge 6 commits intoboostorg:developfrom
Becheler:fix/labeled_graph_remove

Conversation

@Becheler
Copy link
Copy Markdown
Collaborator

@Becheler Becheler commented Mar 30, 2026

Fixes #167

  • labeled_graph.hpp : pointer specialization remove_vertex now uses graph_detail::remove_labeled_vertex(_map, *_graph, l). This fixes labeled_graph::remove_vertex does not remove label #167 as label was not removed from _map
  • labeled_graph.hpp both specializations (graph owning and non-owning): static_assert blocking remove_vertex for vecS label storage. When remove_vertex called vector::erase, it shifts all indices of the labels after the erase point. It was preferred over documentation-only (silent corruption) or runtime error (damage already done before check or pay for a check before every vector::erase call) because the combination is fundamentally broken for any non-trailing removal.
  • labeled_graph.cpp: added test_remove_vertex_suite + _ptr_variant : 5 scenarios across all selector/graph/ownership combos
  • labeled_graph.cpp: added test_multimap_suite + _ptr : 3 duplicate-label scenarios for multimapS/hash_multimapS, owning + pointer
  • test_graphs.cpp: changed defaultS to mapS for unsigned labeled graph : defaultS picks vector, now blocked by static_assert because it invalidates labels
  • compile_fail_remove_vertex_vecS.cpp: new file, verifies static_assert rejects vecS removal at compile time

@Becheler Becheler force-pushed the fix/labeled_graph_remove branch 3 times, most recently from cebd6b0 to 1f4c413 Compare March 31, 2026 07:16
@Becheler Becheler force-pushed the fix/labeled_graph_remove branch 4 times, most recently from a1b6645 to fda61a0 Compare March 31, 2026 09:21
…ould invalidate all label-to-vertex mappings after the erased position
@Becheler Becheler force-pushed the fix/labeled_graph_remove branch from fda61a0 to aeabf1e Compare March 31, 2026 09:30
@Becheler Becheler force-pushed the fix/labeled_graph_remove branch from bd24187 to 5c25561 Compare March 31, 2026 10:19
@Becheler Becheler force-pushed the fix/labeled_graph_remove branch from 5c25561 to 32719a7 Compare March 31, 2026 10:36
@Becheler Becheler force-pushed the fix/labeled_graph_remove branch from 90f0d83 to 912cb87 Compare March 31, 2026 12:38
@Becheler Becheler self-assigned this Mar 31, 2026
@Becheler Becheler added the bug label Mar 31, 2026
@jeremy-murphy jeremy-murphy self-requested a review April 2, 2026 21:14
@jeremy-murphy jeremy-murphy marked this pull request as draft April 2, 2026 21:19
@jeremy-murphy jeremy-murphy marked this pull request as ready for review April 2, 2026 21:20
@jeremy-murphy jeremy-murphy marked this pull request as draft April 2, 2026 21:21
@jeremy-murphy jeremy-murphy marked this pull request as ready for review April 2, 2026 21:21
@jeremy-murphy jeremy-murphy marked this pull request as draft April 2, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

labeled_graph::remove_vertex does not remove label

1 participant