Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
concepts.hpp
1//=======================================================================
2// Copyright 2018 Jeremy William Murphy
3//
4// Distributed under the Boost Software License, Version 1.0. (See
5// accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7//=======================================================================
8
9// Copyright 2021 Arnaud Becheler <abechele@umich.edu>
10
18
19#ifndef BOOST_GRAPH_DETAIL_CONCEPTS_TREE
20#define BOOST_GRAPH_DETAIL_CONCEPTS_TREE
21
22#include <boost/concept/assert.hpp>
23#include <boost/concept/detail/concept_def.hpp>
24#include <boost/concept_check.hpp>
25#include <boost/graph/graph_concepts.hpp>
26
28{
29
30BOOST_concept(ForwardBinaryTree, (G)) : Graph<G>
31{
32 BOOST_CONCEPT_USAGE(ForwardBinaryTree)
33 {
34 t = has_left_successor(u, g);
35 t = has_right_successor(u, g);
36 v = left_successor(u, g);
37 v = right_successor(u, g);
38 t = empty(u, g);
39 const_constraints(g);
40 }
41 void const_constraints(G const &g)
42 {
43 t = has_left_successor(u, g);
44 t = has_right_successor(u, g);
45 v = left_successor(u, g);
46 v = right_successor(u, g);
47 t = empty(u, g);
48 }
49 bool t;
50 G g;
51 typename graph_traits<G>::vertex_descriptor u, v;
52};
53
54BOOST_concept(BidirectionalBinaryTree, (G)) : ForwardBinaryTree<G>
55{
56 BOOST_CONCEPT_USAGE(BidirectionalBinaryTree)
57 {
58 t = has_predecessor(u, g);
59 t = predecessor(u, g);
60 u = root(u, g);
61 const_constraints(g);
62 }
63
64 void const_constraints(G const &g)
65 {
66 t = has_predecessor(u, g);
67 t = predecessor(u, g);
68 u = root(u, g);
69 }
70
71 bool t;
72 G g;
73 typename graph_traits<G>::vertex_descriptor u;
74};
75
76BOOST_concept(MutableForwardBinaryTree, (G)) : ForwardBinaryTree<G>
77{
78 BOOST_CONCEPT_USAGE(MutableForwardBinaryTree)
79 {
80 e = add_left_edge(u, v, g);
81 e = add_right_edge(u, v, g);
82 // TODO: remove_left_edge, remove_right_edge
83 }
84 G g;
85 typename graph_traits<G>::vertex_descriptor u, v;
86 typename graph_traits<G>::edge_descriptor e;
87};
88
89BOOST_concept(MutableBidirectionalBinaryTree, (G)) : MutableForwardBinaryTree<G>
90{
91 BOOST_CONCEPT_USAGE(MutableBidirectionalBinaryTree)
92 {
93 e = add_predecessor(u, v, g);
94 remove_predecessor(u, g);
95 }
96 G g;
97 typename graph_traits<G>::vertex_descriptor u, v;
98 typename graph_traits<G>::edge_descriptor e;
99};
100
101} // namespace boost::concepts
102
103#endif
Definition concepts.hpp:28