vertex_list_adaptor.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. .. Copyright (C) 2004-2008 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| Vertex List Graph Adaptor
  7. ================================
  8. ::
  9. template<typename Graph, typename GlobalIndexMap>
  10. class vertex_list_adaptor
  11. {
  12. public:
  13. vertex_list_adaptor(const Graph& g,
  14. const GlobalIndexMap& index_map = GlobalIndexMap());
  15. };
  16. template<typename Graph, typename GlobalIndexMap>
  17. vertex_list_adaptor<Graph, GlobalIndexMap>
  18. make_vertex_list_adaptor(const Graph& g, const GlobalIndexMap& index_map);
  19. template<typename Graph>
  20. vertex_list_adaptor<Graph, *unspecified*>
  21. make_vertex_list_adaptor(const Graph& g);
  22. The vertex list graph adaptor adapts any model of `Distributed Vertex List
  23. Graph`_ in a `Vertex List Graph`_. In the former type of graph, the
  24. set of vertices is distributed across the process group, so no
  25. process has access to all vertices. In the latter type of graph,
  26. however, every process has access to every vertex in the graph. This
  27. is required by some distributed algorithms, such as the
  28. implementations of `Minimum spanning tree`_ algorithms.
  29. .. contents::
  30. Where Defined
  31. -------------
  32. <``boost/graph/distributed/vertex_list_adaptor.hpp``>
  33. Class template ``vertex_list_adaptor``
  34. --------------------------------------
  35. The ``vertex_list_adaptor`` class template takes a `Distributed
  36. Vertex List Graph`_ and a mapping from vertex descriptors to global
  37. vertex indices, which must be in the range *[0, n)*, where *n* is the
  38. number of vertices in the entire graph. The mapping is a `Readable
  39. Property Map`_ whose key type is a vertex descriptor.
  40. The vertex list adaptor stores only a reference to the underlying
  41. graph, forwarding all operations not related to the vertex list on to
  42. the underlying graph. For instance, if the underlying graph models
  43. `Adjacency Graph`_, then the adaptor will also model `Adjacency
  44. Graph`_. Note, however, that no modifications to the underlying graph
  45. can occur through the vertex list adaptor. Modifications made to the
  46. underlying graph directly will be reflected in the vertex list
  47. adaptor, but modifications that add or remove vertices invalidate the
  48. vertex list adaptor. Additionally, the vertex list adaptor provides
  49. access to the global index map via the ``vertex_index`` property.
  50. On construction, the vertex list adaptor performs an all-gather
  51. operation to create a list of all vertices in the graph within each
  52. process. It is this list that is accessed via *vertices* and the
  53. length of this list that is accessed via *num_vertices*. Due to the
  54. all-gather operation, the creation of this adaptor is a collective
  55. operation.
  56. Function templates ``make_vertex_list_adaptor``
  57. -----------------------------------------------
  58. These function templates construct a vertex list adaptor from a graph
  59. and, optionally, a property map that maps vertices to global index
  60. numbers.
  61. Parameters
  62. ~~~~~~~~~~
  63. IN: ``Graph& g``
  64. The graph type must be a model of `Distributed Vertex List Graph`_.
  65. IN: ``GlobalIndexMap index_map``
  66. A `Distributed property map`_ whose type must model `Readable
  67. property map`_ that maps from vertices to a global index. If
  68. provided, this map must be initialized prior to be passed to the
  69. vertex list adaptor.
  70. **Default:** A property map of unspecified type constructed from a
  71. distributed ``iterator_property_map`` that uses the
  72. ``vertex_index`` property map of the underlying graph and a vector
  73. of ``vertices_size_type``.
  74. Complexity
  75. ~~~~~~~~~~
  76. These operations require *O(n)* time, where *n* is the number of
  77. vertices in the graph, and *O(n)* communication per node in the BSP model.
  78. -----------------------------------------------------------------------------
  79. Copyright (C) 2004 The Trustees of Indiana University.
  80. Authors: Douglas Gregor and Andrew Lumsdaine
  81. .. |Logo| image:: pbgl-logo.png
  82. :align: middle
  83. :alt: Parallel BGL
  84. :target: http://www.osl.iu.edu/research/pbgl
  85. .. _Kruskal's algorithm: http://www.boost.org/libs/graph/doc/kruskal_min_spanning_tree.html
  86. .. _Vertex list graph: http://www.boost.org/libs/graph/doc/VertexListGraph.html
  87. .. _Adjacency graph: http://www.boost.org/libs/graph/doc/AdjacencyGraph.html
  88. .. _distributed adjacency list: distributed_adjacency_list.html
  89. .. _Minimum spanning tree: dehne_gotz_min_spanning_tree.html
  90. .. _Distributed Vertex List Graph: DistributedVertexListGraph.html
  91. .. _Distributed property map: distributed_property_map.html
  92. .. _Readable Property Map: http://www.boost.org/libs/property_map/ReadablePropertyMap.html
  93. .. _Read/Write Property Map: http://www.boost.org/libs/property_map/ReadWritePropertyMap.html