connected_components_parallel_search.rst 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. .. Copyright (C) 2004-2009 The Trustees of Indiana University.
  2. Use, modification and distribution is subject to the Boost Software
  3. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. http://www.boost.org/LICENSE_1_0.txt)
  5. ===========================================
  6. |Logo| Connected Components Parallel Search
  7. ===========================================
  8. ::
  9. namespace graph { namespace distributed {
  10. template<typename Graph, typename ComponentMap>
  11. typename property_traits<ComponentMap>::value_type
  12. connected_components_ps(const Graph& g, ComponentMap c)
  13. } }
  14. The ``connected_components_ps()`` function computes the connected
  15. components of a graph by performing a breadth-first search from
  16. several sources in parallel while recording and eventually resolving
  17. the collisions.
  18. .. contents::
  19. Where Defined
  20. -------------
  21. <``boost/graph/distributed/connected_components_parallel_search.hpp``>
  22. Parameters
  23. ----------
  24. IN: ``const Graph& g``
  25. The graph type must be a model of `Distributed Graph`_. The graph
  26. type must also model the `Incidence Graph`_ and be directed.
  27. OUT: ``ComponentMap c``
  28. The algorithm computes how many connected components are in the
  29. graph, and assigns each component an integer label. The algorithm
  30. then records to which component each vertex in the graph belongs by
  31. recording the component number in the component property map. The
  32. ``ComponentMap`` type must be a `Distributed Property Map`_. The
  33. value type must be the ``vertices_size_type`` of the graph. The key
  34. type must be the graph's vertex descriptor type.
  35. Complexity
  36. ----------
  37. *O(PN^2 + VNP)* work, in *O(N + V)* time, where N is the
  38. number of mappings and V is the number of local vertices.
  39. Algorithm Description
  40. ---------------------
  41. Every *N* th nodes starts a parallel search from the first vertex in
  42. their local vertex list during the first superstep (the other nodes
  43. remain idle during the first superstep to reduce the number of
  44. conflicts in numbering the components). At each superstep, all new
  45. component mappings from remote nodes are handled. If there is no work
  46. from remote updates, a new vertex is removed from the local list and
  47. added to the work queue.
  48. Components are allocated from the ``component_value_allocator``
  49. object, which ensures that a given component number is unique in the
  50. system, currently by using the rank and number of processes to stride
  51. allocations.
  52. When two components are discovered to actually be the same component,
  53. a collision is recorded. The lower component number is prefered in
  54. the resolution, so component numbering resolution is consistent.
  55. After the search has exhausted all vertices in the graph, the mapping
  56. is shared with all processes and they independently resolve the
  57. comonent mapping. This phase can likely be significantly sped up if a
  58. clever algorithm for the reduction can be found.
  59. -----------------------------------------------------------------------------
  60. Copyright (C) 2009 The Trustees of Indiana University.
  61. Authors: Brian Barrett, Douglas Gregor, and Andrew Lumsdaine
  62. .. |Logo| image:: pbgl-logo.png
  63. :align: middle
  64. :alt: Parallel BGL
  65. :target: http://www.osl.iu.edu/research/pbgl
  66. .. _Distributed Graph: DistributedGraph.html
  67. .. _Distributed Property Map: distributed_property_map.html
  68. .. _Incidence Graph: http://www.boost.org/libs/graph/doc/IncidenceGraph.html