@@ -28,40 +28,51 @@ class edge_descriptor final {
2828 edge_descriptor (const edge_descriptor&) = delete ;
2929 edge_descriptor& operator =(const edge_descriptor&) = delete ;
3030
31- explicit edge_descriptor (const types::id_type first, const types::id_type second)
32- : _vertices(first, second) {}
31+ // TODO: private
32+ explicit edge_descriptor (
33+ const types::id_type id, const types::id_type first, const types::id_type second
34+ )
35+ : _id(id), _vertices(first, second) {}
3336
37+ // TODO: private
3438 explicit edge_descriptor (
35- const types::id_type first, const types::id_type second, properties_type properties
39+ const types::id_type id,
40+ const types::id_type first,
41+ const types::id_type second,
42+ properties_type properties
3643 )
3744 requires(not type_traits::is_default_properties_type_v<properties_type>)
38- : _vertices(first, second), _properties(properties) {}
45+ : _id(id) _vertices(first, second), _properties(properties) {}
3946
4047 edge_descriptor (edge_descriptor&&) = default ;
4148 edge_descriptor& operator =(edge_descriptor&&) = default ;
4249
4350 ~edge_descriptor () = default ;
4451
45- [[nodiscard]] constexpr bool is_directed () const {
52+ [[nodiscard]] constexpr bool is_directed () const noexcept {
4653 return type_traits::is_directed_v<type>;
4754 }
4855
49- [[nodiscard]] constexpr bool is_undirected () const {
56+ [[nodiscard]] constexpr bool is_undirected () const noexcept {
5057 return type_traits::is_undirected_v<type>;
5158 }
5259
5360 // clang-format off
5461 // gl_attr_force_inline misplacement
5562
56- [[nodiscard]] gl_attr_force_inline types::homogeneous_pair<const types::id_type> incident_vertices () const {
63+ [[nodiscard]] gl_attr_force_inline types::id_type id () const noexcept {
64+ return this ->_id ;
65+ }
66+
67+ [[nodiscard]] gl_attr_force_inline types::homogeneous_pair<const types::id_type> incident_vertices () const noexcept {
5768 return this ->_vertices ;
5869 }
5970
60- [[nodiscard]] gl_attr_force_inline const types::id_type first () const {
71+ [[nodiscard]] gl_attr_force_inline const types::id_type first () const noexcept {
6172 return this ->_vertices .first ;
6273 }
6374
64- [[nodiscard]] gl_attr_force_inline const types::id_type second () const {
75+ [[nodiscard]] gl_attr_force_inline const types::id_type second () const noexcept {
6576 return this ->_vertices .second ;
6677 }
6778
@@ -78,25 +89,28 @@ class edge_descriptor final {
7889 throw std::invalid_argument (std::format (" Got invalid vertex id: {}" , vertex_id));
7990 }
8091
81- [[nodiscard]] gl_attr_force_inline bool is_incident_with (const types::id_type vertex_id) const {
92+ [[nodiscard]] gl_attr_force_inline bool is_incident_with (const types::id_type vertex_id
93+ ) const noexcept {
8294 return vertex_id == this ->_vertices .first or vertex_id == this ->_vertices .second ;
8395 }
8496
8597 // true if the given vertex is the `source` of the edge
86- [[nodiscard]] gl_attr_force_inline bool is_incident_from (const types::id_type vertex_id) const {
98+ [[nodiscard]] gl_attr_force_inline bool is_incident_from (const types::id_type vertex_id
99+ ) const noexcept {
87100 return directional_tag::is_incident_from (*this , vertex_id);
88101 }
89102
90103 // true if the given vertex is the `target` vertex of the edge
91- [[nodiscard]] gl_attr_force_inline bool is_incident_to (const types::id_type vertex_id) const {
104+ [[nodiscard]] gl_attr_force_inline bool is_incident_to (const types::id_type vertex_id
105+ ) const noexcept {
92106 return directional_tag::is_incident_to (*this , vertex_id);
93107 }
94108
95- [[nodiscard]] gl_attr_force_inline bool is_loop () const {
109+ [[nodiscard]] gl_attr_force_inline bool is_loop () const noexcept {
96110 return this ->_vertices .first == this ->_vertices .second ;
97111 }
98112
99- [[nodiscard]] gl_attr_force_inline properties_type& properties () const {
113+ [[nodiscard]] gl_attr_force_inline properties_type& properties () const noexcept {
100114 return this ->_properties ;
101115 }
102116
@@ -136,6 +150,7 @@ class edge_descriptor final {
136150 os << " [" << this ->_vertices .first << " , " << this ->_vertices .second << " ]" ;
137151 }
138152
153+ types::id_type _id;
139154 types::homogeneous_pair<types::id_type> _vertices;
140155 [[no_unique_address]] mutable properties_type _properties{};
141156};
0 commit comments