p align="justify"> # include «stdafx.h»
# include «edge.h»
# include «graph_coverage.h» std
{ :: istream & operator >> (Std :: istream & in, std :: pair & p)
{>> p.first >> p.second; in;
}
} boost :: adjacency_list
< :: ListS, :: vecS, :: directedS
> ;
/////////////////////////////////////////////////////////////////////////<typename T> read_values_in_set (std :: istream & input, size_t values_count, std :: set * result)
{std :: istream_iterator in_it (input); std :: istream_iterator in_end; (size_t i=0; i
{(in_it!=in_end); std :: pair :: iterator, bool> insert_result=result-> insert (* in_it); (insert_result.second); (i
{
+ + in_it;
}
}
}
/*------------------------------------------------------------------------*/output_test(const std :: list & path_accumulator, std :: ostream & output)
{<< «{»; :: List :: const_iterator end=path_accumulator.end (); (std :: list :: const_iterator it=path_accumulator.begin (); it!=End ;) p>
{size_t val=* it;
+ + it; << val; (it!=end)
{<< «-> »;
}
} << «}» << std :: endl;
}
/*------------------------------------------------------------------------*/save_to_collection(const std :: list & path, std :: list > & pathes_collection)
{_collection.push_back (path);
}
/*------------------------------------------------------------------------*/<BoostAdjacencyList, VertexDescriptor
> trace_graph (const BoostAdjacencyList & graph, VertexDescriptor & current_vertex, std :: set & final_vertices, :: list & path_accumulator, :: vector & visits_count_vector, :: list > & pathes_collection)
{size_t vertex_index=current_vertex;
if (final_vertices.find (vertex_index)!=final_vertices.end ())
{/ / Reached final vertex_accumulator.push_back (vertex_index); _to_collection (path_accumulator, pathes_collection); _accumulator.pop_back ();;
} (out_degree (current_vertex, graph) == 0)
{/ / No out edges;
} (visits_count_vector [vertex_index] <= 2); (visits_count_vector [vertex_index] == 2)
{;
}
++visits_count_vector[vertex_index];_accumulator.push_back(vertex_index);std::pair<BoostAdjacencyList::out_edge_iterator, BoostAdjacencyList :: out_edge_iterator> out_edges_range=boost :: out_edges (current_vertex, graph); (out_edges_range.first!=out_edges_range.second)
{next_verte...