YT-CPPGL-56: Replace the usage of pointers for vertex and edge storage to simple composite types [Part 3]#59
Conversation
It would require aligning all edge ids after removing a single edge, which is fine, but it would also require aligning all edge ids after removing a vertex, and this operation might remove multiple edges at once and the logic of aligning the edge ids in that situation would be too complex to spend any more time on this now, while the hypergraph module implementation is the main focuse of the 2.0.0 release of the library...
There was a problem hiding this comment.
Pull Request Overview
This PR fundamentally refactors the graph library's storage model, replacing pointer-based storage of vertices and edges with ID-based storage. The changes eliminate custom iterator wrappers in favor of standard library views and modify vertex/edge descriptors to use value semantics with reference-based property access.
Key Changes:
- Replaced edge pointer storage with edge ID storage in adjacency structures
- Removed custom iterator types (
iterator_range,dereferencing_iterator,non_null_iterator) in favor of standard library views - Changed vertex and edge descriptors from non-copyable pointer-based objects to copyable value types with optional property references
- Introduced
invalid_idconstant for marking invalid/removed elements
Reviewed Changes
Copilot reviewed 58 out of 58 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
include/gl/vertex_descriptor.hpp |
Changed from non-copyable to copyable; properties now accessed via reference wrapper; added is_valid() and invalid() methods |
include/gl/edge_descriptor.hpp |
Stores vertex IDs instead of vertex references; added ID field; properties via reference wrapper; added validity checks and equality operators |
include/gl/edge_tags.hpp |
Removed pointer type aliases and factory functions; simplified to only directional tag functionality |
include/gl/graph.hpp |
Major refactor: stores vertex/edge properties in separate vectors; methods now work with IDs; removed pointer-based logic |
include/gl/impl/adjacency_matrix.hpp |
Changed from storing edge pointers to edge IDs; returns views/ranges instead of custom iterators |
include/gl/impl/adjacency_list.hpp |
Uses adjacency_list_item structure with edge ID and target ID; returns views instead of custom iterators |
include/gl/impl/specialized/*.hpp |
Updated to work with ID-based storage; simplified edge removal logic |
include/gl/types/properties.hpp |
Added property concepts (c_empty_properties, c_non_empty_properties) |
include/gl/types/types.hpp |
Removed reference wrapper type aliases |
include/gl/constants.hpp |
Added invalid_id constant |
include/gl/util/ranges.hpp |
New utility file with deref_view and range_size helpers |
tests/**/*.cpp |
Updated all tests to use new API patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0f16e67 to
16fcaf4
Compare
378b435 to
1d6bb79
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 47 out of 47 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
iterator_range,dereferencing_iteratorandnon_null_iteratortypes and replaced them with standard library viewsinvalid_idconstant and aligned the vertex and edge descriptor types to use this constant for default constructionedge_infotype used for graph MST finding