used_color_incident_vertices (constGraphT & graph, constVertexT & vert, VertexOutputIteratorT out)
{:: pair adj_vert = boost :: adjacent_vertices (vert, graph); :: map color_usage; // color -> usage count :: map colored_vertex; // color -> vertex (autoi = adj_vert.first; i! = adj_vert.second; + + i)
{(graph [* i]. color! = 0)
{
+ + color_usage [graph [* i]. color]; _vertex [graph [* i]. color] = * i;
}
} :: vector once_used_colors; _if_all (color_usage.begin (), color_usage.end (), std :: back_inserter (once_used_colors), color_usage_pred_t > (1)); (autoi = once_used_colors.begin (); i! = once_used_colors.end (); + + i)
{
* out + + = colored_vertex [* i];
}
} _paths_dfs_visitor: public boost :: default_dfs_visitor
{: _paths_dfs_visitor (constVertexT & source_vertex, constVertexT & target_vertex, & out_iter)
: source (source_vertex), target (target_vertex), out (out_iter)
{} _vertex (VertexT & v, GraphT & g)
{(! current_chain.empty ())
{_chain.push_back (v);
} (v == source)
{_chain.push_back (v);
}
if (v == target)
{
// зберегти в списку ланцюгів
* out + + = current_chain;
}
} _vertex (VertexT & v, GraphT & g)
{(current_chain.empty ())
{;
} (current_chain.back () == v)
{_chain.pop_back ();
}
} ::: list current_chain; source; target; out; _vertex_ttarget_vertex;
}; {(autoi = once_colored_vertices.begin (); i! = once_colored_vertices.end (); + + i)
{(graph [* i]. color == 0)
{;
} j = i; (+ + j! = once_colored_vertices.end ())
{(graph [* j]. color == 0)
{;
}
// знайти всі шляхи між * I та * j
std :: list > * I);
// перевіряємо, естьліунасдвуцветниепуті (ланцюги) між * I та * j
for (auto k = paths.begin (); k! = paths.end (); + + k)