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-CPPGL-56: Replace the usage of pointers for vertex and edge storage to simple composite types [Part 1] (#57)
- The `graph` class does not store a list of vertices directly, only the number of vertices and optionally a vertex properties map
- Added a vertex property map getter to the `graph` class
- Vertices are compared only using IDs within the graph representation models
- Removed vertex validation within implementation types - only the `graph` class validates vertices
- The properties members of the vertex and edge classes are now private with added getter methods
-*Return type*: A random access *view* with values of type `types::id_type` : `std::ranges::iota_view`.
149
149
150
150
-**`graph.get_vertex(vertex_id) const`**:
151
151
-*Description*: Retrieves the vertex object associated with the given vertex ID.
@@ -296,6 +296,10 @@ Based on the specified traits, the `graph` class defines the following types:
296
296
-*Description*: Returns a vector containing the degrees of the corresponding vertices (degree at index `i` corresponds to the vertex with an ID equal `i`).
297
297
-*Return type*: `std::vector<types::size_type>`
298
298
299
+
-**`graph.vertex_properties_map() const`**:
300
+
-*Description*: Returns a *map-like view* the properties of the corresponding vertices (property at index `i` corresponds to the vertex with an ID equal `i`).
301
+
-*Return type*: A random access view with values of type `vertex_properties_type&`
Copy file name to clipboardExpand all lines: docs/graph_elements.md
+46-39Lines changed: 46 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,17 +14,17 @@ This section provides an overview of the `vertex_descriptor` and `edge_descripto
14
14
15
15
## The vertex class
16
16
17
-
The `vertex_descriptor` class represents the identity of a vertex in the graph, optionally carrying additional properties as specified by the user. This class is designed for use within the `Graph` class and serves as a lightweight identifier for vertices, providing an interface for accessing vertex properties, comparing vertex descriptors, and outputting vertex information.
17
+
The `vertex_descriptor` class represents the vertex in the graph, optionally carrying additional properties as specified by the user. This class is designed for use within the `graph` class and serves as a lightweight identifier for vertices, providing an interface for accessing vertex properties, comparing vertex descriptors, and outputting vertex information.
18
18
19
19
By default, the `vertex_descriptor` class does not carry any properties. However, properties can be associated with each vertex by passing a custom type as the template parameter `Properties`, making it highly flexible and customizable for various graph use cases.
20
20
21
-
### Template parameters
21
+
### Template Parameters
22
22
23
23
-**`Properties`**: A type that defines the properties associated with each vertex.
24
24
-*Default value*: `types::empty_properties`
25
25
-*Constraints*: must satisfy the **`type_traits::c_properties`** concept
26
26
27
-
### Member types
27
+
### Member Types
28
28
29
29
-**`type`**: Alias for the `vertex_descriptor` itself.
30
30
-**`properties_type`**: Type of the vertex properties as defined by the `Properties` template parameter.
@@ -37,10 +37,10 @@ By default, the `vertex_descriptor` class does not carry any properties. However
37
37
- Constructs a `vertex_descriptor` with a unique ID and specified properties.
38
38
-*Constraints*: the `properties_type` must be non-default.
39
39
-**Move constructor and assignment operator**: *default*
40
+
-**Copy constructor and assignment operator**: *default*
40
41
41
42
-**Deleted**:
42
43
-**Default constructor**: prevent creating multiple vertices with the default ID within a graph.
43
-
-**Copy constructor and assignment operator**: prevent copying of `vertex_descriptor` instances, as they are meant to be identificators.
44
44
45
45
### Desctructor
46
46
@@ -52,6 +52,10 @@ The destructor is *defaulted*, allowing proper cleanup of the `vertex_descriptor
52
52
-*Description*: Returns the unique identifier of the vertex.
53
53
-*Return type*: `types::id_type`
54
54
55
+
-**`properties()`**:
56
+
-*Description*: Returns a mutable reference to the properties associated with the vertex.
-*Description*: Returns the vertex on the other end of the edge relative to the provided vertex. Throws an error if the provided vertex is not incident with the edge.
167
155
-*Returned value*:
168
156
- $v$ if $\text{vertex} = u$
@@ -172,24 +160,31 @@ The destructor is *defaulted*, allowing proper cleanup of the `edge_descriptor`
172
160
-`vertex: const vertex_type&` – the vertex for which the opposite vertex is requested.
-*Description*: Returns the ID of the vertex on the other end of the edge relative to the provided vertex ID. Throws an error if the provided vertex ID is invalid.
163
+
-**`incident_vertex(vertex_id) const`**:
164
+
-*Description*: Returns the vertex on the other end of the edge relative to the provided vertex ID. Throws an error if the provided vertex ID is invalid.
177
165
-*Returned value*:
178
-
- $v_{id}$ if $\text{vertex-id} = u_{id}$
179
-
- $u_{id}$ if $\text{vertex-id} = v_{id}$
166
+
- $v$ if $\text{vertex-id} = u_{id}$
167
+
- $u$ if $\text{vertex-id} = v_{id}$
180
168
- error otherwise
181
169
-*Parameters*:
182
170
-`vertex_id: const types::id_type` – the vertex ID for which the opposite vertex ID is requested.
0 commit comments