GraphDom
Loading...
Searching...
No Matches
full_labeled_set_digraph.h
1/*
2 * Copyright 2026 Michele Comparini
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef GRAPHDOM_FULL_LABELED_SET_DIGRAPH_H
8#define GRAPHDOM_FULL_LABELED_SET_DIGRAPH_H
9
10#include <set>
11
12#include "labeled_vertex_graph.h"
13#include "labeled_vertex_set_graph.h"
14#include "labeled_edge_graph.h"
15#include "labeled_edge_non_mixed_graph.h"
16
17namespace graphdom {
27 template<
28 typename VertexType,
29 typename VertexLabelType,
30 typename EdgeLabelType,
31 typename Compare = std::less<VertexType>,
32 typename VertexLabellerType = default_vertex_labeller<VertexType,VertexLabelType>,
33 typename EdgeLabellerType = default_edge_labeller<VertexType,EdgeLabelType>
34 >
35 class full_labeled_set_digraph final :
36 virtual public labeled_vertex_set_graph<VertexType,VertexLabelType,VertexLabellerType>,
37 virtual public labeled_edge_non_mixed_graph<VertexType,EdgeLabelType,EdgeLabellerType> {
38 public:
39 full_labeled_set_digraph() = default;
40 full_labeled_set_digraph(const Compare& v_comp, const VertexLabellerType& v_lab, const EdgeLabellerType& e_lab);
41 full_labeled_set_digraph(const Compare& v_comp, const VertexLabellerType& v_lab, EdgeLabellerType&& e_lab = EdgeLabellerType());
42 full_labeled_set_digraph(const Compare& v_comp, VertexLabellerType&& v_lab, const EdgeLabellerType& e_lab);
43 explicit full_labeled_set_digraph(const Compare& v_comp, VertexLabellerType&& v_lab = VertexLabellerType(), EdgeLabellerType&& e_lab = EdgeLabellerType());
44 full_labeled_set_digraph(Compare&& v_comp, const VertexLabellerType& v_lab, const EdgeLabellerType& e_lab);
45 full_labeled_set_digraph(Compare&& v_comp, const VertexLabellerType& v_lab, EdgeLabellerType&& e_lab = EdgeLabellerType());
46 full_labeled_set_digraph(Compare&& v_comp, VertexLabellerType&& v_lab, const EdgeLabellerType& e_lab);
47 explicit full_labeled_set_digraph(Compare&& v_comp, VertexLabellerType&& v_lab = VertexLabellerType(), EdgeLabellerType&& e_lab = EdgeLabellerType());
48
49 ~full_labeled_set_digraph() override;
50
56 [[nodiscard]] std::size_t order() const override;
60 [[nodiscard]] const VertexLabelType& get_vertex_label(const typename graph<VertexType>::vertex_const_handle& vertex) const override;
64 [[nodiscard]] const EdgeLabelType& get_edge_label(const typename graph<VertexType>::adj_list_const_iterator&) const override;
65
69 void erase_vertex(const typename graphdom::graph<VertexType>::vertex_const_handle& vertex) override;
73 [[nodiscard]] typename graphdom::graph<VertexType>::adj_list_iterator erase_edge(const typename graph<VertexType>::adj_list_const_iterator&) override;
77 [[nodiscard]] VertexLabelType& get_vertex_label(const typename graph<VertexType>::vertex_const_handle& vertex) override;
78 using graphdom::labeled_vertex_set_graph<VertexType,VertexLabelType,VertexLabellerType>::insert_vertex;
84 [[nodiscard]] std::pair<typename graph<VertexType>::vertex_handle,bool> insert_vertex(const VertexType& v_core, const VertexLabelType& vertex_label) override;
90 [[nodiscard]] std::pair<typename graph<VertexType>::vertex_handle,bool> insert_vertex(const VertexType& v_core, VertexLabelType&& vertex_label) override;
96 [[nodiscard]] std::pair<typename graph<VertexType>::vertex_handle,bool> insert_vertex(VertexType&& v_core, const VertexLabelType& vertex_label) override;
102 [[nodiscard]] std::pair<typename graph<VertexType>::vertex_handle,bool> insert_vertex(VertexType&& v_core, VertexLabelType&& vertex_label) override;
106 [[nodiscard]] EdgeLabelType& get_edge_label(const typename graph<VertexType>::adj_list_const_iterator&) override;
107 using graphdom::labeled_edge_non_mixed_graph<VertexType,EdgeLabelType,EdgeLabellerType>::insert_edge;
116 void insert_edge(const typename graph<VertexType>::vertex_const_handle& tail, const typename graph<VertexType>::vertex_const_handle& head, const EdgeLabelType& edge_label) override;
126 void insert_edge(const typename graph<VertexType>::vertex_const_handle& tail, const typename graph<VertexType>::vertex_const_handle& head, EdgeLabelType&& edge_label) override;
127 private:
128 using VertexContainerPointerType = typename graphdom::set_graph<VertexType>::VertexContainerPointerType;
129 using edge_endpoint = typename graphdom::set_graph<VertexType>::template labeled_directed_edge_endpoint<EdgeLabelType>;
130 using adj_set = typename graphdom::set_graph<VertexType>::adj_set;
131 using vertex_container = typename graphdom::set_graph<VertexType>::template non_mixed_graph_labeled_vertex_container<VertexLabelType>;
132
133 static void safe_edge_endpoint_deallocation(typename graphdom::graph<VertexType>::template edge_endpoint<VertexContainerPointerType>*);
134
135 class custom_vertices_set_compare {
136 public:
137 custom_vertices_set_compare() = default;
138 explicit custom_vertices_set_compare(const Compare& comp) : external_vertex_less_functor(comp){}
139 explicit custom_vertices_set_compare(Compare&& comp) : external_vertex_less_functor(std::move(comp)){}
140
141 bool constexpr operator()(
142 const vertex_container& left,
143 const vertex_container& right ) const {
144 return external_vertex_less_functor(left.vertex,right.vertex);
145 }
146
147 using is_transparent = void;
148
149 bool constexpr operator()(
150 const vertex_container& left,
151 const VertexType& right ) const {
152 return external_vertex_less_functor(left.vertex,right);
153 }
154
155 bool constexpr operator()(
156 const VertexType& left,
157 const vertex_container& right ) const {
158 return external_vertex_less_functor(left,right.vertex);
159 }
160 private:
161 Compare external_vertex_less_functor;
162 };
163
164 std::set<
165 vertex_container,
166 custom_vertices_set_compare
167 > vertices;
168 };
169}
170
171#include "impl/full_labeled_set_digraph.h"
172
173#endif //GRAPHDOM_FULL_LABELED_SET_DIGRAPH_H
This class template is the default vertex labeller used by all labeled-edge graphs if no user-specifi...
Definition labeled_edge_graph.h:37
This class template is the default vertex labeller used by all labeled-vertex graphs if no user-speci...
Definition labeled_vertex_graph.h:53
const VertexLabelType & get_vertex_label(const typename graph< VertexType >::vertex_const_handle &vertex) const override
Definition full_labeled_set_digraph.h:86
void erase_vertex(const typename graphdom::graph< VertexType >::vertex_const_handle &vertex) override
Removes the vertex identified by vertex.
Definition full_labeled_set_digraph.h:111
std::size_t order() const override
Returns the order of *this, i.e. the number of vertices inside the graph.
Definition full_labeled_set_digraph.h:81
void insert_edge(const typename graph< VertexType >::vertex_const_handle &tail, const typename graph< VertexType >::vertex_const_handle &head, const EdgeLabelType &edge_label) override
Definition full_labeled_set_digraph.h:314
graphdom::graph< VertexType >::adj_list_iterator erase_edge(const typename graph< VertexType >::adj_list_const_iterator &) override
Definition full_labeled_set_digraph.h:148
std::pair< typename graph< VertexType >::vertex_handle, bool > insert_vertex(const VertexType &v_core, const VertexLabelType &vertex_label) override
Definition full_labeled_set_digraph.h:177
const EdgeLabelType & get_edge_label(const typename graph< VertexType >::adj_list_const_iterator &) const override
Definition full_labeled_set_digraph.h:96
Every valid instance of this class can be used to identify a specific vertex of a graph and to access...
Definition vertex_const_handle.h:35
Every graph created using this library is an instance of a concrete class publicly derived,...
Definition graph.h:43
Every labeled-edge non-mixed graph created using this library is an instance of a concrete class publ...
Definition labeled_edge_non_mixed_graph.h:23
Every labeled-vertex set graph created using this library is an instance of a concrete class publicly...
Definition labeled_vertex_set_graph.h:24
Every set graph created using this library is an instance of a concrete class publicly derived,...
Definition set_graph.h:18
Definition adj_list.h:16