Conversation
Implements BGL-style mutation members on dynamic_graph_base:
- add_vertex() sequential containers: append, return new id
- add_vertex(val) sequential containers, VV != void
- add_vertex(id) associative containers: keyed insert, returns bool
- add_vertex(id, val) associative containers, VV != void
- add_edge(u, v) both vertices must exist, throws out_of_range otherwise
- add_edge(u, v, val) EV != void overload; in-edge receives copy before move
- remove_edge(u, v) returns count removed; maintains bidirectional in_edges
- remove_vertex(u) sequential: renumbers edge ids; associative: stable keys
Bug fix: add_edge now validates the target vertex for non-bidirectional graphs
(vertex_at(vid) was only called unconditionally in the Bidirectional path).
Also adds tests/container/dynamic_graph/test_dynamic_graph_mutation.cpp:
- 54 test cases, 399 assertions, all passing
- TEMPLATE_TEST_CASE over sequential (vov/vol/vofl/vos/vom/dov) and
associative (mov/mol/uov) container combinations
- Covers EV=void and EV=int, VV=void and VV=int, bidirectional graphs,
non-integral (std::string) vertex ids, and error/edge cases
…remove_edge - Rename create_vertex->add_vertex, create_edge->add_edge, erase_edge->remove_edge (old names removed, no backward-compat aliases) - Add remove_edge(uid, vid) and remove_vertex(uid) with id renumbering and std::out_of_range bounds checks - Add ual_edge::renumber_after_vertex_erase helper - Fix remove_edge(edge_iterator) to unlink before destroying the edge - Fix graph-level edges() member to pass derived graph_type to edge_iterator - Add test_undirected_adjacency_list_mutation.cpp and register it - Update call sites across container/views/algorithm tests
Move all non-trivial function bodies out of undirected_adjacency_list.hpp and into detail/undirected_adjacency_list_impl.hpp (which is #included at the end of the header). Only declarations now remain in the main header. Moved definitions: - ual_edge_value::value() (2 overloads) - ual_vertex_value::value() (2 overloads) - ual_vertex_edge_list::const_iterator ctor, graph(), source_id() - ual_vertex_edge_list::iterator ctor and move ctor - ual_vertex_edge_list_link ctor and all getters (vertex_id, vertex, next, prev) - ual_edge::renumber_after_vertex_erase() - base_undirected_adjacency_list::const_edge_iterator (all methods) - base_undirected_adjacency_list::edge_iterator (all methods) - num_vertices(), num_edges(), has_edge(), edges() (2 overloads) - add_vertex() (3 overloads), add_edge() (6 overloads) - undirected_adjacency_list::graph_value() (2 overloads) - Non-member CPO free functions: find_vertex (2), target_id, source_id, edge_value (2) Hidden friend ADL functions (edges, in_edges, edge_value, vertex_value) remain in the class body as required for correct ADL-only lookup. All 39,368 assertions pass.
dynamic_graph: - Add dynamic_graph_base(size_type vertex_count, vertex_allocator_type alloc) constructor that pre-creates N default-constructed vertices via resize_vertices/terminate_partitions - Add forwarding dynamic_graph(size_type vertex_count, allocator_type alloc) constructor to both the GV and GV=void specializations bgl_migration_strategy.md: - Pattern 2: split graph-v3 example into initializer-list and N-vertex + add_edge forms - Pattern 4: replace manual dist init with init_shortest_paths(g, dist, pred); add note that BGL initializes internally while graph-v3 does not - Concept Mapping: fix EdgeListGraph row to cite basic_sourced_edgelist / basic_sourced_index_edgelist concepts; note edgelist(g) is a view, not a concept - Concept Mapping: simplify MutableGraph row (no mutating CPOs in current design) - Section 12.1: add note distinguishing 'no graph_traits to specialise' from dynamic_graph traits (concept-based, supports non-stdlib containers) - Section 12.3: add note directing readers to the shipped BGL adaptor (graph/adaptors/bgl/graph_adaptor.hpp); retain example for pedagogical value - Section 12.5: add 'No bundled properties' subsection documenting per-property function objects with prop(g,u) / prop(g,uv) call interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.