CkPttn 1.2.4
Loading...
Searching...
No Matches
tree.hpp
Go to the documentation of this file.
1
9#ifndef CKPTTN_MIDLEVEL_TREE_HPP
10#define CKPTTN_MIDLEVEL_TREE_HPP
11
12#include <list>
13#include <vector>
14
15#include "vertex.hpp"
16
24class MidTree {
25 public:
30 explicit MidTree(const MidVertex& x);
32 bool flip_tree();
34 void rotate();
39 void to_bitstring(int x[]) const;
40
41 private:
42 int num_vertices_;
43 int root_;
44 std::vector<std::list<int>> children_;
45 std::vector<int> parent_;
46
47 int deg(int u) const;
48 int num_children(int u) const;
49 int ith_child(int u, int i) const;
50 bool is_tau_preimage() const;
51 bool is_tau_image() const;
52 void tau();
53 void tau_inverse();
54 void move_leaf(int leaf, int new_parent, int pos);
55 void rotate_to_vertex(int u);
56 void rotate_children();
57 void rotate_children(int k);
58 void root_canonically();
59 void compute_center(int& c1, int& c2) const;
60 bool is_flip_tree_tau();
61 bool is_star() const;
62 bool is_light_dumbbell() const;
63 bool is_thin_leaf(int u) const;
64 bool has_thin_leaf() const;
65 int count_pending_edges(int u) const;
66 void to_bitstring_rec(int x[], int u, int& pos) const;
67 int min_string_rotation(int x[], int length);
68};
69
70#endif
Tree data structure for mid-level Gray code algorithm.
Definition tree.hpp:24
void rotate()
Rotate the tree to a canonical form.
MidTree(const MidVertex &x)
Construct a MidTree from a MidVertex bitstring.
bool flip_tree()
Perform a flip-tree operation (tau transformation)
void to_bitstring(int x[]) const
Convert the tree to a bitstring representation.
Bitstring vertex for middle-levels Gray code algorithm.
Definition vertex.hpp:24
Bitstring vertex representation for middle-levels Gray code.