src/GRAPHGEN/drag2optimal.cpp
// Converts a tree into dag minimizing the number of nodes (Note: this is "necessary" when the leaves of a tree contain multiple actions)
// USES NUMBER OF NODES TO PICK THE OPTIMAL DAG
Converts a tree into dag minimizing the number of nodes (Note: this is "necessary" when the leaves of a tree contain multiple actions)
USES NUMBER OF NODES TO PICK THE OPTIMAL DAG
Converts a tree into dag minimizing the number of nodes ( Note : this is " necessary " when the leaves of a tree contain multiple actions ) USES NUMBER OF NODES TO PICK THE OPTIMAL DAG
void Dag2OptimalDag(BinaryDrag<conact>& t) {
    std::vector<BinaryDrag<conact>> trees;
    BinaryDrag<conact> best_tree;
    std::map<const BinaryDrag<conact>::node*, bool> visited_nodes;
    uint counter = 0;
    size_t best_nodes = std::numeric_limits<size_t>::max();
    size_t best_leaves = std::numeric_limits<size_t>::max();
    Dag2OptimalDagRec(t, t.GetRoot(), best_tree, best_nodes, best_leaves, visited_nodes, counter);
    std::cout << "** Vector size:" << counter << " **\n";
    std::cout << "** Counter:" << counter << " **\n";
    t = best_tree;
}
void Dag2OptimalDag ( BinaryDrag < conact > & t ) { std :: vector < BinaryDrag < conact > > trees ; BinaryDrag < conact > best_tree ; std :: map < const BinaryDrag < conact > :: node * , bool > visited_nodes ; uint counter = 0 ; size_t best_nodes = std :: numeric_limits < size_t > :: max ( ) ; size_t best_leaves = std :: numeric_limits < size_t > :: max ( ) ; Dag2OptimalDagRec ( t , t . GetRoot ( ) , best_tree , best_nodes , best_leaves , visited_nodes , counter ) ; std :: cout << " " << counter << " \n " ; std :: cout << " " << counter << " \n " ; t = best_tree ; }
Converts a tree into dag minimizing the number of nodes (Note: this is "necessary" when the leaves of a tree contain multiple actions)
USES NUMBER OF NODES TO PICK THE OPTIMAL DAG
Converts a tree into dag minimizing the number of nodes ( Note : this is " necessary " when the leaves of a tree contain multiple actions ) USES NUMBER OF NODES TO PICK THE OPTIMAL DAG
/*for (size_t i = 0; i < trees.size(); ++i) {
    DrawDagOnFile("tree_" + to_string(i), trees[i]);
    Dag2DagUsingIdenties(trees[i]);
    DrawDagOnFile("dag_" + to_string(i), trees[i]);
    }

    BestDagFromList(trees, t);*/