7 #ifndef GRAPHGEN_REMOVE_EQUAL_SUBTREES_H_
8 #define GRAPHGEN_REMOVE_EQUAL_SUBTREES_H_
10 #include <unordered_set>
23 std::unordered_map<std::string, BinaryDrag<conact>::node*>
sp_;
24 std::unordered_map<BinaryDrag<conact>::node*, std::string>
ps_;
28 for (
auto& t : bd.
roots_) {
36 auto itps =
ps_.find(n);
37 if (itps != end(
ps_)) {
47 const std::vector<uint>& a = n->data.actions();
48 s =
'.' + std::to_string(a[0]);
49 for (std::size_t i = 1; i < a.size(); ++i) {
50 s +=
',' + std::to_string(a[i]);
52 s +=
'-' + std::to_string(n->data.next);
58 s = n->data.condition + sl + sr;
61 auto it =
sp_.find(s);
std::vector< node * > roots_
This class allows to "remove" equal subtrees from a BinaryDrag.
std::string RemoveEqualSubtreesRec(BinaryDrag< conact >::node *&n)
std::unordered_map< std::string, BinaryDrag< conact >::node * > sp_
RemoveEqualSubtrees(BinaryDrag< conact > &bd)
std::unordered_map< BinaryDrag< conact >::node *, std::string > ps_