GraphDom
Loading...
Searching...
No Matches
labeled_vertex_graph.h
1/*
2 * Copyright 2026 Michele Comparini
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef GRAPHDOM_LABELED_VERTEX_GRAPH_H
8#define GRAPHDOM_LABELED_VERTEX_GRAPH_H
9
10#include "graph.h"
11
12namespace graphdom {
14
20 template <typename VertexType, typename VertexLabelType>
21 class labeled_vertex_graph : virtual public graph<VertexType> {
22 public:
24 ~labeled_vertex_graph() override = default;
25
34 [[nodiscard]] virtual const VertexLabelType& get_vertex_label(const typename graph<VertexType>::vertex_const_handle& vertex) const = 0;
35
44 [[nodiscard]] virtual VertexLabelType& get_vertex_label(const typename graph<VertexType>::vertex_const_handle& vertex) = 0;
45 };
46}
47
48namespace graphdom {
52 template <typename VertexType, typename VertexLabelType>
54 public:
60 [[nodiscard]] constexpr VertexLabelType operator()(const VertexType&) const {
61 return VertexLabelType();
62 }
63 };
64}
65
66#endif //GRAPHDOM_LABELED_VERTEX_GRAPH_H
This class template is the default vertex labeller used by all labeled-vertex graphs if no user-speci...
Definition labeled_vertex_graph.h:53
constexpr VertexLabelType operator()(const VertexType &) const
Definition labeled_vertex_graph.h:60
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-vertex graph created using this library is an instance of a concrete class publicly der...
Definition labeled_vertex_graph.h:21
~labeled_vertex_graph() override=default
To be polymorphic, this class has a virtual destructor.
virtual VertexLabelType & get_vertex_label(const typename graph< VertexType >::vertex_const_handle &vertex)=0
virtual const VertexLabelType & get_vertex_label(const typename graph< VertexType >::vertex_const_handle &vertex) const =0
Definition adj_list.h:16