|
Mungojerrie
1.1
Mungojerrie
|
Go to the documentation of this file.
64 int size(
void)
const {
return numNodes; }
66 std::set<State>
getLabel(
int node)
const {
return label[node]; }
68 void setLabel(
int node, std::set<State> newlabel) { label[node] = newlabel; }
70 void addLastChild(
int parent, std::set<State>
const & childLabel);
82 void preorder(std::vector<int> &order)
const;
88 std::string
toDot(std::string graphname = std::string(
"tree"),
89 std::string subgraph = std::string(
""))
const;
91 static int constexpr
undef = -1;
93 bool isDefined(
int node)
const {
return node !=
undef; }
94 void restrictLabelsRecur(
int node, std::set<State> & subset);
95 void preorderRecur(std::vector<int> &order,
int node = 0)
const;
96 void toStringRecur(
int node, std::ostringstream & oss)
const;
98 std::vector< std::set<State> > label;
99 std::vector<int> parent;
100 std::vector<int> elder;
101 std::vector<int> younger;
102 std::vector<int> lastChild;
void setLabel(int node, std::set< State > newlabel)
Sets the label of a node in the tree.
Definition: Stree.hh:68
std::ostream & operator<<(std::ostream &os, Stree const &t)
Stream insertion operator for Safra trees.
static constexpr int undef
Index of an undefined node.
Definition: Stree.hh:91
int size(void) const
Returns the number of nodes in the tree.
Definition: Stree.hh:64
Stree(void)
Constructor.
Definition: Stree.cc:54
Class of compact Safra trees used for Piterman's NBW to DPW procedure.
Definition: Stree.hh:59
void removeSubtree(int node)
Removes the subtree rooted at "node.".
Definition: Stree.cc:81
void removeDescendants(int node)
Removes the descendants of a node from the tree.
Definition: Stree.cc:212
bool isGreen(int node) const
Checks whether node of tree "flashes green.".
Definition: Stree.cc:196
void makeContiguous(void)
Gives contiguous numbers to the nodes of the tree.
Definition: Stree.cc:112
void addLastChild(int parent, std::set< State > const &childLabel)
Adds a node to the tree as last child of "parent.".
Definition: Stree.cc:57
bool isIsomorphic(Stree const &other, int root=0, int otherRoot=0) const
Compares two trees.
Definition: Stree.cc:247
void restrictLabels(void)
Restricts the label of a node to help restore the tree invariant.
Definition: Stree.cc:159
std::string toDot(std::string graphname=std::string("tree"), std::string subgraph=std::string("")) const
Converts the tree to dot format.
Definition: Stree.cc:313
void preorder(std::vector< int > &order) const
Returns the nodes of the tree in preorder.
Definition: Stree.cc:222
std::string toString(void) const
Returns a string describing the tree.
Definition: Stree.cc:274
std::set< State > getLabel(int node) const
Returns the set of states that label a node of the tree.
Definition: Stree.hh:66