@@ -72,11 +72,11 @@ class hypergraph final {
7272 }
7373
7474 [[nodiscard]] vertex_type get_vertex (const types::id_type vertex_id) const {
75- // this->_verify_vertex_id(vertex_id);
75+ this ->_verify_vertex_id (vertex_id);
7676 if constexpr (type_traits::c_non_empty_properties<vertex_properties_type>)
77- return vertex_descriptor {vertex_id, *this ->_vertex_properties [vertex_id]};
77+ return vertex_type {vertex_id, *this ->_vertex_properties [vertex_id]};
7878 else
79- return vertex_descriptor {vertex_id};
79+ return vertex_type {vertex_id};
8080 }
8181
8282 [[nodiscard]] gl_attr_force_inline bool has_vertex (const types::id_type vertex_id) const {
@@ -92,12 +92,12 @@ class hypergraph final {
9292 const auto new_vertex_id = this ->_n_vertices ++;
9393
9494 if constexpr (type_traits::c_non_empty_properties<vertex_properties_type>)
95- return vertex_descriptor {
95+ return vertex_type {
9696 new_vertex_id,
9797 *this ->_vertex_properties .emplace_back (std::make_unique<vertex_properties_type>())
9898 };
9999 else
100- return vertex_descriptor {new_vertex_id};
100+ return vertex_type {new_vertex_id};
101101 }
102102
103103 const vertex_type add_vertex_with (vertex_properties_type properties)
@@ -107,7 +107,7 @@ class hypergraph final {
107107 this ->_vertex_properties .push_back (
108108 std::make_unique<vertex_properties_type>(std::move (properties))
109109 );
110- return vertex_descriptor {this ->_n_vertices ++, *this ->_vertex_properties .back ()};
110+ return vertex_type {this ->_n_vertices ++, *this ->_vertex_properties .back ()};
111111 }
112112
113113 void add_vertices (const types::size_type n) {
@@ -142,8 +142,8 @@ class hypergraph final {
142142 }
143143
144144 void remove_vertex (const types::size_type vertex_id) {
145- // this->_verify_vertex_id(vertex_id);
146- // this->_remove_vertex_impl(vertex_id);
145+ this ->_verify_vertex_id (vertex_id);
146+ this ->_remove_vertex_impl (vertex_id);
147147 }
148148
149149 gl_attr_force_inline void remove_vertex (const vertex_type& vertex) {
@@ -174,6 +174,28 @@ class hypergraph final {
174174 }
175175
176176private:
177+ // --- vertex methods ---
178+
179+ gl_attr_force_inline void _verify_vertex_id (const types::id_type vertex_id) const {
180+ if (not this ->has_vertex (vertex_id))
181+ throw std::out_of_range (std::format (" Got invalid vertex id [{}]" , vertex_id));
182+ }
183+
184+ void _remove_vertex_impl (const types::id_type vertex_id) {
185+ // const auto removed_edge_ids = this->_impl.remove_vertex(vertex_id);
186+ this ->_n_vertices --;
187+ // this->_n_edges -= removed_edge_ids.size();
188+
189+ // if constexpr (type_traits::c_non_empty_properties<vertex_properties_type>)
190+ // this->_vertex_properties.erase(this->_vertex_properties.begin() + vertex_id);
191+
192+ // if constexpr (type_traits::c_non_empty_properties<edge_properties_type>) {
193+ // // IDs are sorted and do not contain duplicates
194+ // for (const auto& edge_id : std::views::reverse(removed_edge_ids))
195+ // this->_edge_properties.erase(this->_edge_properties.begin() + edge_id);
196+ // }
197+ }
198+
177199 types::size_type _n_vertices = 0uz;
178200 types::size_type _n_hyperedges = 0uz;
179201
0 commit comments