Sequoia
Loading...
Searching...
No Matches
StaticGraphTraversalDetails.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2018. //
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
19
20namespace sequoia::maths::graph_impl
21{
22 template<static_network G> struct traversal_tracking_traits<G>
23 {
24 using bitset = std::array<bool, G::order()>;
25
26 [[nodiscard]]
27 constexpr static bitset make_bitset(const G&)
28 {
29 return bitset{};
30 }
31 };
32
33 template<static_network G>
34 struct traversal_traits_base<G, traversal_flavour::breadth_first>
35 {
36 using queue_type = data_structures::static_queue<typename G::edge_index_type, G::order()>;
37
38 [[nodiscard]]
39 constexpr static auto get_container_element(const queue_type& q) { return q.front(); }
40 };
41
42 template<static_network G>
43 struct traversal_traits_base<G, traversal_flavour::pseudo_depth_first>
44 {
45 using queue_type = data_structures::static_stack<typename G::edge_index_type, G::order()>;
46
47 [[nodiscard]]
48 constexpr static auto get_container_element(const queue_type& s) { return s.top(); }
49 };
50
51 template<static_network G, class Compare>
52 struct traversal_traits_base<G, traversal_flavour::priority, Compare>
53 {
54 using queue_type = data_structures::static_priority_queue<typename G::edge_index_type, G::order(), Compare>;
55
56 [[nodiscard]]
57 constexpr static auto get_container_element(const queue_type& q) { return q.top(); }
58 };
59}
Meta-programming urilities and underlying function for graph traversals.
A constexpr prority queue.
A constexpr queue.
A constexpr stack.