You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YT-CPPHGL-3: Define the vertex and edge descriptor types
- Added a `hgl::vertex_descriptor` generic alias for the `gl::vertex_descriptor` type.
- Defined the hyperedge directional tag types, i.e. `undirected_t` and `bf_directed_t`
- Implemented a simple `hyperedge_descriptor` generic type
- Aligned the directional-related type constraints in the `gl` module to match the new `hgl` constraints
- Removed redundant `gl` module code
Copy file name to clipboardExpand all lines: docs/algorithms.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -286,7 +286,7 @@ This section covers the specific types and type traits used for the algorithm im
286
286
> The `algorithm::paths_descriptor` structure is defined as follows:
287
287
>
288
288
> -*Template parameters*:
289
-
> -`VertexDistanceType: type_traits::c_basic_arithmetic` - The type of the distance between vertices in the graph.
289
+
> -`VertexDistanceType: type_traits::c_arithmetic` - The type of the distance between vertices in the graph.
290
290
> -*Type definitions*:
291
291
> -`distance_type` - An alias for `VertexDistanceType`.
292
292
> -*Constructors*:
@@ -444,7 +444,7 @@ Additionaly you can use the depth-first/breadth-first search algorithm templates
444
444
445
445
-*Template parameters*:
446
446
-`GraphType: type_traits::c_graph` - The type of the graph on which the search is performed.
447
-
-`InitQueueRangeType: type_traits::c_sized_range_of<algorithm::vertex_info>` (default = `std::vector<algorithm::vertex_info>`) - The type of the `vertex_info` range which will be inserted into the queue at the beginning of the algorithm.
447
+
-`InitQueueRangeType: type_traits::c_forward_range_of<algorithm::vertex_info>` (default = `std::vector<algorithm::vertex_info>`) - The type of the `vertex_info` range which will be inserted into the queue at the beginning of the algorithm.
448
448
-`VisitVertexPredicate: type_traits::c_optional_id_callback<bool>` - The vertex visiting unary predicate type.
449
449
-`VisitCallback: type_traits::c_optional_id_callback<bool, types::id_type>` - The vertex visting callback type (arguments: `vertex_id, pred_id`).
450
450
-`EnqueueVertexPred: type_traits::c_id_callback<algorithm::predicate_result, const typename GraphType::edge_type&>` - The vertex enqueue predicate type (arguments: `vertex_id, in_edge`)
@@ -475,7 +475,7 @@ Additionaly you can use the depth-first/breadth-first search algorithm templates
475
475
-*Template parameters*:
476
476
-`GraphType: type_traits::c_graph` - The type of the graph on which the search is performed.
477
477
-`PQCompare: std::predicate<algorithm::vertex_info, algorithm::vertex_info>` - The type of the vertex priority queue comparator.
478
-
-`InitQueueRangeType: type_traits::c_sized_range_of<algorithm::vertex_info>` (default = `std::vector<algorithm::vertex_info>`) - The type of the `vertex_info` range which will be inserted into the queue at the beginning of the algorithm.
478
+
-`InitQueueRangeType: type_traits::c_forward_range_of<algorithm::vertex_info>` (default = `std::vector<algorithm::vertex_info>`) - The type of the `vertex_info` range which will be inserted into the queue at the beginning of the algorithm.
479
479
-`VisitVertexPredicate: type_traits::c_optional_id_callback<bool>` - The vertex visiting unary predicate type.
480
480
-`VisitCallback: type_traits::c_optional_id_callback<bool, types::id_type>` - The vertex visting callback type (arguments: `vertex, source_id`).
481
481
-`EnqueueVertexPred: type_traits::c_id_callback<algorithm::predicate_result, const typename GraphType::edge_type&>` - The vertex enqueue predicate type (arguments: `vertex, in_edge`)
Copy file name to clipboardExpand all lines: docs/graph.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,11 +90,11 @@ Based on the specified traits, the `graph` class defines the following types:
90
90
|`implementation_type`| The underlying data structure used to store the graph's edges and the adjacency information |
91
91
|`vertex_type`| The type of the vertex element (an instantiation of `vertex_descriptor`) |
92
92
|`vertex_properties_type`| The type of the properties element associated with each vertex |
93
-
|`vertex_iterator_type`| The iterator type used for vertex traversal in the graph|
93
+
|`vertex_properties_map_type`| The type of the properties map element associated with each vertex|
94
94
|`edge_type`| The type of the edge element (an instantiation of `edge_descriptor`) |
95
95
|`edge_directional_tag`| The `EdgeDirectionalTag` parameter of the `graph_traits` structure |
96
96
|`edge_properties_type`| The type of the properties element associated with each edge |
97
-
|`edge_iterator_type`| The iterator type used for edge traversal in the graph|
97
+
|`edge_properties_map_type`| The type of the properties map element associated with each edge|
98
98
99
99
<br />
100
100
<br />
@@ -106,7 +106,7 @@ Based on the specified traits, the `graph` class defines the following types:
106
106
-**`graph()`**:
107
107
- Default constructor. Creates an empty graph with no vertices or edges.
108
108
109
-
-**`graph(n_vertices)`**:
109
+
-**`explicit graph(n_vertices)`**:
110
110
- Constructs a graph with the specified number of vertices. Each vertex is initialized with default properties and no adjacent edges.
111
111
112
112
> [!IMPORTANT]
@@ -195,6 +195,9 @@ Based on the specified traits, the `graph` class defines the following types:
195
195
> [!IMPORTANT]
196
196
> Simliarily to the graph constructors using the `add_vertices*` methods is more efficient than calling `add_vertex` multiple times which might cause more vector reallocations.
197
197
198
+
> [!WARNING]
199
+
> Removing vertices may invalidate previously created vertex and edge descriptor objects.
200
+
198
201
-**`graph.remove_vertex(vertex_id)`**:
199
202
-*Description*: Removes the vertex with the given ID from the graph.
200
203
-*Parameters*:
@@ -210,15 +213,15 @@ Based on the specified traits, the `graph` class defines the following types:
-*Description*: Removes multiple vertices from the graph based on a range of vertex IDs. The IDs are sorted in descending order and duplicate IDs are removed before deletion.
212
215
-*Template parameters*:
213
-
-`IdRange: type_traits::c_sized_range_of<types::id_type>` – A range of vertex IDs, which must satisfy the size and type constraints.
216
+
-`IdRange: type_traits::c_forward_range_of<types::id_type>` – A range of vertex IDs, which must satisfy the size and type constraints.
214
217
-*Parameters*:
215
218
-`vertex_id_range: const IdRange&` – A range of vertex IDs to be removed.
-*Description*: Removes multiple vertices from the graph based on a range of vertex references. The references are sorted in descending order and duplicates are removed before deletion.
220
223
-*Parameters*:
221
-
-`vertex_ref_range: const type_traits::c_sized_range_of<types::id_type> auto&` – A range of vertex references to be removed.
224
+
-`vertex_range: const type_traits::c_forward_range_of<types::id_type> auto&` – A range of vertex references to be removed.
222
225
-*Return type*: `void`
223
226
224
227
-**`graph.in_degree(vertex) const`**:
@@ -434,6 +437,9 @@ Based on the specified traits, the `graph` class defines the following types:
434
437
-`target: const vertex_type&` – the target vertex.
435
438
-*Return type*: `std::vector<edge_type>`
436
439
440
+
> [!WARNING]
441
+
> Removing edges may invalidate previously created edge descriptor objects.
442
+
437
443
-**`graph.remove_edge(edge)`**:
438
444
-*Description*: Removes the specified edge from the graph.
439
445
-*Parameters*:
@@ -524,10 +530,6 @@ Based on the specified traits, the `graph` class defines the following types:
524
530
<br />
525
531
<br />
526
532
527
-
## Additional utility
528
-
529
-
In addition to the core functionality of the `graph` class, the [gl/graph_utility.hpp](/include/gl/graph_utility.hpp) file provides a set of utility functions and type traits that offer extended support for graph manipulation and property handling. Below is an overview of the key utilities provided.
530
-
531
533
### Type traits
532
534
533
535
To write safe and more expressive graph utility of your own, you can use the defined concepts and type traits:
@@ -537,9 +539,9 @@ To write safe and more expressive graph utility of your own, you can use the def
537
539
538
540
|**Trait**|**Description**|
539
541
| :- | :- |
540
-
|`c_graph<T>`| Ensures that the template parameter `T` is a specialization of the `graph` class |
541
-
|`c_directed_graph<T>`| Equivalent to `c_graph<T> and is_directed_v<T>`<br/>Ensures that the template parameter `T` is a *directed* specialization of the `graph` class |
542
-
|`c_undirected_graph<T>`| Equivalent to `c_graph<T> and is_undirected_v<T>`<br/>Ensures that the template parameter `T` is an *undirected* specialization of the `graph` class |
542
+
|`c_graph<G>`| Ensures that the template parameter `G` is a specialization of the `graph` class |
543
+
|`c_directed_graph<G>`| Equivalent to `c_graph<G> and c_directed_edge<typename G::edge_type>`<br/>Ensures that the template parameter `G` is a *directed* specialization of the `graph` class |
544
+
|`c_undirected_graph<G>`| Equivalent to `c_graph<G> and c_undirected_edge<typename G::edge_type>`<br/>Ensures that the template parameter `G` is an *undirected* specialization of the `graph` class |
543
545
544
546
> [!TIP]
545
547
> More (not graph class specific) type traits and concepts are defined in the [gl/types/traits/](/include/gl/types/traits/) directory.
0 commit comments