X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libs%2Fgraph%2Ftest%2Fdfs.cpp;h=d958ba4410fc636d9140f10ee10ecf3f0348c10e;hb=08c1e93fa36a49f49325a07fe91ff92c964c2b6c;hp=fdffd4ef18de1946bc3d5bdf43d50afd9762ccbe;hpb=bb4dd8289b351fae6b55e303f189127a394a1edd;p=platform%2Fupstream%2Fboost.git diff --git a/libs/graph/test/dfs.cpp b/libs/graph/test/dfs.cpp index fdffd4e..d958ba4 100644 --- a/libs/graph/test/dfs.cpp +++ b/libs/graph/test/dfs.cpp @@ -68,6 +68,12 @@ public: using namespace boost; BOOST_CHECK( get(m_color, target(e, g)) == Color::black() ); } + template + void finish_edge(Edge e, Graph& g) { + using namespace boost; + BOOST_CHECK( get(m_color, target(e, g)) == Color::gray() || + get(m_color, target(e, g)) == Color::black() ); + } template void finish_vertex(Vertex u, Graph&) { using namespace boost; @@ -116,9 +122,24 @@ struct dfs_test std::vector discover_time(num_vertices(g)), finish_time(num_vertices(g)); - dfs_test_visitor vis(color, &parent[0], - &discover_time[0], &finish_time[0]); + // Get vertex index map + typedef typename boost::property_map::const_type idx_type; + idx_type idx = get(boost::vertex_index, g); + + typedef + boost::iterator_property_map::iterator, idx_type> + parent_pm_type; + parent_pm_type parent_pm(parent.begin(), idx); + typedef + boost::iterator_property_map::iterator, idx_type> + time_pm_type; + time_pm_type discover_time_pm(discover_time.begin(), idx); + time_pm_type finish_time_pm(finish_time.begin(), idx); + + dfs_test_visitor + vis(color, parent_pm, + discover_time_pm, finish_time_pm); boost::depth_first_search(g, visitor(vis).color_map(color)); @@ -136,10 +157,10 @@ struct dfs_test || finish_time[v] < discover_time[u] || (discover_time[v] < discover_time[u] && finish_time[u] < finish_time[v] - && boost::is_descendant(u, v, &parent[0])) + && boost::is_descendant(u, v, parent_pm)) || (discover_time[u] < discover_time[v] && finish_time[v] < finish_time[u] - && boost::is_descendant(v, u, &parent[0])) + && boost::is_descendant(v, u, parent_pm)) ); } }