Running a depth algorithm at a specific vertex

I am trying to find a way to execute the depth algorithm at a specific vertex using the accelerated graph library.

The depth algorithm provided by the Boost library evaluates a graph starting from the starting vertex to the last vertex. But what if a graph needs to be searched from a specific vertex?

Any suggestions?

+3
source share
2 answers

See the BGL documentation .

There is overload where you can provide the starting vertex.

template <class Graph, class DFSVisitor, class ColorMap>
void depth_first_search(const Graph& g, DFSVisitor vis, ColorMap color, 
                        typename graph_traits<Graph>::vertex_descriptor start)
+3
source

BGL depth_first_search. , ColorMap, :

boost::depth_first_search(myGraph, boost::visitor(myVisitor).root_vertex(myVertex));

0

Source: https://habr.com/ru/post/1784101/


All Articles