CkPttn 1.2.5
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
29class MidTree {
30 public:
35 explicit MidTree(const MidVertex& x);
37 bool flip_tree();
39 void rotate();
44 void to_bitstring(int x[]) const;
45
46 private:
47 int num_vertices_;
48 int root_;
49 std::vector<std::list<int>> children_;
50 std::vector<int> parent_;
51
52 int deg(int u) const;
53 int num_children(int u) const;
54 int ith_child(int u, int i) const;
55 bool is_tau_preimage() const;
56 bool is_tau_image() const;
57 void tau();
58 void tau_inverse();
59 void move_leaf(int leaf, int new_parent, int pos);
60 void rotate_to_vertex(int u);
61 void rotate_children();
62 void rotate_children(int k);
63 void root_canonically();
64 void compute_center(int& c1, int& c2) const;
65 bool is_flip_tree_tau();
66 bool is_star() const;
67 bool is_light_dumbbell() const;
68 bool is_thin_leaf(int u) const;
69 bool has_thin_leaf() const;
70 int count_pending_edges(int u) const;
71 void to_bitstring_rec(int x[], int u, int& pos) const;
72 int min_string_rotation(int x[], int length);
73};
74
75#endif
Tree data structure for mid-level Gray code algorithm.
Definition tree.hpp:29
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.