7 #ifndef GRAPHGEN_DRAG_STATISTICS_H_
8 #define GRAPHGEN_DRAG_STATISTICS_H_
23 std::set<const BinaryDrag<conact>::node*> visited_nodes;
24 std::set<const BinaryDrag<conact>::node*> visited_leaves;
28 visited_leaves.insert(n);
32 if (visited_nodes.insert(n).second) {
33 PerformStatistics(n->left);
34 PerformStatistics(n->right);
44 for (
const auto& t : bd.
roots_) {
53 auto Nodes()
const {
return visited_nodes.size(); }
59 auto Leaves()
const {
return visited_leaves.size(); }
68 for (
const auto& l : visited_leaves) {
70 for (
const auto& a : l->data.actions()) {
73 os <<
"- " << l->data.next <<
"\n";
76 os <<
"----------------------------------\n";
A BinaryDrag is the GRAPHGEN implementation of a Binary Directed Rooted Acyclic Graph (DRAG in short)
std::vector< node * > roots_
Calculates the statistics of a binary drag with one or multiple roots.
auto Nodes() const
Returns the number of unique nodes inside the DRAG.
void PrintLeaves(std::ostream &os=std::cout)
Reverse into the specified output stream the unique leaves of a BinaryDrag.
BinaryDragStatistics(const BinaryDrag< conact > &bd)
The constructor creates the object and directly calculates the statistics.
auto Leaves() const
Returns the number of unique leaves inside the DRAG.
void PrintStats(const BinaryDrag< conact > &bd, std::ostream &os=std::cout)
Displays on the specified output stream the statistics of a DRAG (number of unique nodes an unique le...