29 #ifndef GRAPHGEN_CONACT_TREE_H_
30 #define GRAPHGEN_CONACT_TREE_H_
89 std::unordered_set<BinaryDrag<conact>::node*>
visited_;
110 for (
auto& x : bd.
roots_) {
113 for (
auto& x : bd.
roots_) {
120 os_ << std::string(tab,
'\t');
133 auto a = n->data.actions();
135 for (
size_t i = 1; i < a.size(); ++i) {
138 os_ <<
" - " << n->data.next <<
"\n";
142 os_ << n->data.condition <<
"\n";
152 std::unordered_map<int, BinaryDrag<conact>::node*>
np_;
200 is_ >> action >> std::ws;
201 n->data.action.set(action - 1);
202 }
while (
is_.peek() ==
',' &&
is_.get());
204 if (
is_.get() !=
'-') {
212 n->data.condition = s;
void AddRoot(node *r)
Adds a new root to the vector of roots.
std::vector< node * > roots_
node * make_node(Args &&... args)
Creates and returns a new node updating the nodes_ vector.
bool LoadConactDrag(BinaryDrag< conact > &t, const std::string &filename)
bool WriteConactDrag(BinaryDrag< conact > &t, const std::string &filename)
void IntersectTrees(BinaryDrag< conact >::node *n1, BinaryDrag< conact >::node *n2)
bool EqualTrees(const BinaryDrag< conact >::node *n1, const BinaryDrag< conact >::node *n2)
Checks whether two (sub)trees 'n1' and 'n2' are equal or nor.
bool WriteConactTree(const BinaryDrag< conact > &t, const std::string &filename)
Saves a tree into a file structured as described in the LoadConactTree()
void intersect_leaves(BinaryDrag< conact >::node *n1, BinaryDrag< conact >::node *n2)
bool LoadConactTree(BinaryDrag< conact > &t, const std::string &filename)
Loads a tree from file.
bool equivalent_trees(const BinaryDrag< conact >::node *n1, const BinaryDrag< conact >::node *n2)
Load(std::istream &is, BinaryDrag< conact > &bd)
std::unordered_map< int, BinaryDrag< conact >::node * > np_
BinaryDrag< conact > & bd_
BinaryDrag< conact >::node * LoadConactTreeRec()
Save(std::ostream &os, BinaryDrag< conact > &bd)
void CheckNodesTraversalRec(BinaryDrag< conact >::node *n)
std::unordered_map< BinaryDrag< conact >::node *, int > nodes_with_refs_
void SaveRec(BinaryDrag< conact >::node *n, int tab=0)
std::unordered_set< BinaryDrag< conact >::node * > visited_