...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template<typename DistributedGraph, typename DFSVisitor> void depth_first_visit(const DistributedGraph& g, typename graph_traits<DistributedGraph>::vertex_descriptor s, DFSVisitor vis); namespace graph { template<typename DistributedGraph, typename DFSVisitor, typename VertexIndexMap> void tsin_depth_first_visit(const DistributedGraph& g, typename graph_traits<DistributedGraph>::vertex_descriptor s, DFSVisitor vis); template<typename DistributedGraph, typename DFSVisitor, typename VertexIndexMap> void tsin_depth_first_visit(const DistributedGraph& g, typename graph_traits<DistributedGraph>::vertex_descriptor s, DFSVisitor vis, VertexIndexMap index_map); template<typename DistributedGraph, typename ColorMap, typename ParentMap, typename ExploreMap, typename NextOutEdgeMap, typename DFSVisitor> void tsin_depth_first_visit(const DistributedGraph& g, typename graph_traits<DistributedGraph>::vertex_descriptor s, DFSVisitor vis, ColorMap color, ParentMap parent, ExploreMap explore, NextOutEdgeMap next_out_edge); }
The depth_first_visit() function performs a distributed depth-first traversal of an undirected graph using Tsin's corrections [Tsin02] to Cidon's algorithm [Cidon88]. The distributed DFS is syntactically similar to its sequential counterpart, which provides additional background and discussion. Differences in semantics are highlighted here, and we refer the reader to the documentation of the sequential depth-first search for the remainder of the details. Visitors passed to depth-first search need to account for the distribution of vertices across processes, because events will be triggered on certain processes but not others. See the section Visitor Event Points for details.
<boost/graph/distributed/depth_first_search.hpp>
also available in
<boost/graph/depth_first_search.hpp>
A model of Readable Property Map whose key type is the vertex descriptor type of the graph g and whose value type is an integral type. The property map should map from vertices to their (local) indices in the range [0, num_vertices(g)).
Default: get(vertex_index, g)
The color map must be a Distributed Property Map with the same process group as the graph g whose colors must monotonically darken (white -> gray -> black).
Default: A distributed iterator_property_map created from a std::vector of default_color_type.
The parent map must be a Distributed Property Map with the same process group as the graph g whose key and values types are the same as the vertex descriptor type of the graph g. This property map holds the parent of each vertex in the depth-first search tree.
Default: A distributed iterator_property_map created from a std::vector of the vertex descriptor type of the graph.
The explore map must be a Distributed Property Map with the same process group as the graph g whose key and values types are the same as the vertex descriptor type of the graph g.
Default: A distributed iterator_property_map created from a std::vector of the vertex descriptor type of the graph.
The next out-edge map must be a Distributed Property Map with the same process group as the graph g whose key type is the vertex descriptor of the graph g and whose value type is the out_edge_iterator type of the graph. It is used internally to keep track of the next edge that should be traversed from each vertex.
Default: A distributed iterator_property_map created from a std::vector of the out_edge_iterator type of the graph.
Depth-first search is inherently sequential, so parallel speedup is very poor. Regardless of the number of processors, the algorithm will not be faster than O(V); see [Tsin02] for more details.
The DFS Visitor concept defines 8 event points that will be triggered by the sequential depth-first search. The distributed DFS retains these event points, but the sequence of events triggered and the process in which each event occurs will change depending on the distribution of the graph.
The three most important things to remember when updating an existing DFS visitor for distributed DFS or writing a new distributed DFS visitor are:
[Cidon88] | Isreal Cidon. Yet another distributed depth-first-search algorithm. Information Processing Letters, 26(6):301--305, 1988. |
[Tsin02] | (1, 2) Y. H. Tsin. Some remarks on distributed depth-first search. Information Processing Letters, 82(4):173--178, 2002. |
Copyright (C) 2005 The Trustees of Indiana University.
Authors: Douglas Gregor and Andrew Lumsdaine