#pragma once #include #include #include #include // Generic printer for tree template void write_tree_to_dot(const T & tree, NodeString && node_string, std::ostream & out){ using namespace std; out << "digraph g {\n"; // breadth first int global_id = 0; queue>> work; work.push({global_id++, tree}); while(!work.empty()){ const auto id = work.front().first; const T & node = work.front().second; work.pop(); out << "\n\ts" << id << " [label=\""; node_string(node, out); out << "\"];\n"; for(auto && c : node.children){ int new_id = global_id++; out << "\ts" << id << " -> " << "s" << new_id << ";\n"; work.push({new_id, c}); } } out << "}" << endl; } // Specialized printing for splitting trees and dist seqs struct splitting_tree; void write_splitting_tree_to_dot(const splitting_tree & root, std::ostream & out); void write_splitting_tree_to_dot(const splitting_tree & root, std::string const & filename); struct adaptive_distinguishing_sequence; void write_adaptive_distinguishing_sequence_to_dot(const adaptive_distinguishing_sequence & root, std::ostream & out); void write_adaptive_distinguishing_sequence_to_dot(const adaptive_distinguishing_sequence & root, std::string const & filename);