Sequoia
Loading...
Searching...
No Matches
GraphTraits.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2020. //
3// Distributed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. //
4// (See accompanying file LICENSE.md or copy at //
5// https://www.gnu.org/licenses/gpl-3.0.en.html) //
7
8#pragma once
9
15namespace sequoia::maths
16{
17 template<class N>
18 concept network = requires(const N& n) {
19 typename N::edge_type;
20 typename N::edge_weight_type;
21 typename N::edge_index_type;
22 typename N::edge_init_type;
23 typename N::size_type;
24 typename N::const_edge_iterator;
25 typename N::const_reverse_edge_iterator;
26
27 { n.size() } -> std::same_as<typename N::size_type>;
28 { n.order() } -> std::same_as<typename N::size_type>;
29 { n.cbegin_edges(0) } -> std::same_as<typename N::const_edge_iterator>;
30 { n.cend_edges(0) } -> std::same_as<typename N::const_edge_iterator>;
31 };
32
33 template<class G>
34 inline constexpr bool dynamic_nodes{
35 requires(std::remove_const_t<G>& g) { g.erase_node(0); }
36 || requires(std::remove_const_t<G>& g) { g.prune(0); }
37 };
38
39 template<class G>
40 inline constexpr bool heterogeneous_nodes{
41 requires { typename G::heterogeneous_nodes_type; }
42 };
43
44 template<class G>
45 inline constexpr bool static_nodes{!dynamic_nodes<G>};
46
47 template<class G>
48 concept dynamic_network = network<G> && dynamic_nodes<G>;
49
50 template<class G>
51 concept static_network = network<G> && static_nodes<G>;
52
53 template<class G>
54 concept heterogeneous_network = network<G> && heterogeneous_nodes<G>;
55
56 template<class T>
57 concept dynamic_tree = dynamic_network<T> && requires {
58 T::link_dir;
59 };
60
61}
Definition: GraphTraits.hpp:48
Definition: GraphTraits.hpp:57
Definition: GraphTraits.hpp:54
Definition: GraphTraits.hpp:18
Definition: GraphTraits.hpp:51