53 std::function<std::string (
64 auto ranks = std::vector<size_t>( tree.
node_count(), 0 );
67 auto parents = std::vector<size_t>();
74 if( limit_ > 0 && count > limit_ ) {
79 size_t cur_idx = it.node().index();
80 size_t par_idx = it.link().outer().node().index();
83 while (!parents.empty() && parents.back() != par_idx) {
86 parents.push_back(cur_idx);
87 ranks[cur_idx] =
degree( it.node() ) - 1;
91 if (it.is_first_iteration()) {
93 out << print_line( it.node(), it.edge() ) <<
"\n";
101 assert( parents.size() >= 2 );
102 assert( parents[ parents.size() - 2 ] == par_idx );
103 assert( parents[ parents.size() - 1 ] == cur_idx );
107 for (
size_t i = 0; i < parents.size() - 2; ++i) {
108 if (ranks[parents[i]] > 0) {
109 if( limit_ > 0 && count == limit_ ) {
124 assert(ranks[par_idx] > 0);
127 if( limit_ > 0 && count == limit_ ) {
135 if (ranks[par_idx] > 0) {
142 out << print_line( it.node(), it.edge() ) <<
"\n";
151 std::function<std::string (
156 std::ostringstream res;
157 print( res, tree, print_line );
166 if( edge.has_data() ) {
177 return print(tree, print_line);