non_distributed_betweenness_centrality.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
  7. <title>Parallel BGL Non-Distributed Betweenness Centrality</title>
  8. <link rel="stylesheet" href="../../../../rst.css" type="text/css" />
  9. </head>
  10. <body>
  11. <div class="document" id="logo-non-distributed-betweenness-centrality">
  12. <h1 class="title"><a class="reference external" href="http://www.osl.iu.edu/research/pbgl"><img align="middle" alt="Parallel BGL" class="align-middle" src="pbgl-logo.png" /></a> Non-Distributed Betweenness Centrality</h1>
  13. <!-- Copyright (C) 2004-2009 The Trustees of Indiana University.
  14. Use, modification and distribution is subject to the Boost Software
  15. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  16. http://www.boost.org/LICENSE_1_0.txt) -->
  17. <pre class="literal-block">
  18. // named parameter versions
  19. template&lt;typename ProcessGroup, typename Graph, typename Param, typename Tag, typename Rest&gt;
  20. void
  21. non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg, const Graph&amp; g,
  22. const bgl_named_params&lt;Param,Tag,Rest&gt;&amp; params);
  23. template&lt;typename ProcessGroup, typename Graph, typename CentralityMap,
  24. typename Buffer&gt;
  25. void
  26. non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg, const Graph&amp; g,
  27. CentralityMap centrality, Buffer sources);
  28. template&lt;typename ProcessGroup, typename Graph, typename CentralityMap,
  29. typename EdgeCentralityMap, typename Buffer&gt;
  30. void
  31. non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg, const Graph&amp; g,
  32. CentralityMap centrality,
  33. EdgeCentralityMap edge_centrality_map,
  34. Buffer sources);
  35. // non-named parameter versions
  36. template&lt;typename ProcessGroup, typename Graph, typename CentralityMap,
  37. typename EdgeCentralityMap, typename IncomingMap, typename DistanceMap,
  38. typename DependencyMap, typename PathCountMap, typename VertexIndexMap,
  39. typename Buffer&gt;
  40. void
  41. non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg,
  42. const Graph&amp; g,
  43. CentralityMap centrality,
  44. EdgeCentralityMap edge_centrality_map,
  45. IncomingMap incoming,
  46. DistanceMap distance,
  47. DependencyMap dependency,
  48. PathCountMap path_count,
  49. VertexIndexMap vertex_index,
  50. Buffer sources);
  51. template&lt;typename ProcessGroup, typename Graph, typename CentralityMap,
  52. typename EdgeCentralityMap, typename IncomingMap, typename DistanceMap,
  53. typename DependencyMap, typename PathCountMap, typename VertexIndexMap,
  54. typename WeightMap, typename Buffer&gt;
  55. void
  56. non_distributed_brandes_betweenness_centrality(const ProcessGroup&amp; pg,
  57. const Graph&amp; g,
  58. CentralityMap centrality,
  59. EdgeCentralityMap edge_centrality_map,
  60. IncomingMap incoming,
  61. DistanceMap distance,
  62. DependencyMap dependency,
  63. PathCountMap path_count,
  64. VertexIndexMap vertex_index,
  65. WeightMap weight_map,
  66. Buffer sources);
  67. // helper functions
  68. template&lt;typename Graph, typename CentralityMap&gt;
  69. typename property_traits&lt;CentralityMap&gt;::value_type
  70. central_point_dominance(const Graph&amp; g, CentralityMap centrality);
  71. </pre>
  72. <p>The <tt class="docutils literal"><span class="pre">non_distributed_betweenness_centrality()</span></tt> function computes the
  73. betweenness centrality of the vertices and edges in a graph. The name
  74. is somewhat confusing, the graph <tt class="docutils literal"><span class="pre">g</span></tt> is not a distributed graph,
  75. however the algorithm does run in parallel. Rather than parallelizing
  76. the individual shortest paths calculations that are required by
  77. betweenness centrality, this variant of the algorithm performs the
  78. shortest paths calculations in parallel with each process in <tt class="docutils literal"><span class="pre">pg</span></tt>
  79. calculating the shortest path from a different set of source vertices
  80. using the BGL's implementation of <a class="reference external" href="http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html">Dijkstra shortest paths</a>. Each
  81. process accumulates into it's local centrality map and once all the
  82. shortest paths calculations are performed a reduction is performed to
  83. combine the centrality from all the processes.</p>
  84. <div class="contents topic" id="contents">
  85. <p class="topic-title first">Contents</p>
  86. <ul class="simple">
  87. <li><a class="reference internal" href="#where-defined" id="id1">Where Defined</a></li>
  88. <li><a class="reference internal" href="#parameters" id="id2">Parameters</a></li>
  89. <li><a class="reference internal" href="#complexity" id="id3">Complexity</a></li>
  90. <li><a class="reference internal" href="#algorithm-description" id="id4">Algorithm Description</a></li>
  91. </ul>
  92. </div>
  93. <div class="section" id="where-defined">
  94. <h1><a class="toc-backref" href="#id1">Where Defined</a></h1>
  95. <p>&lt;<tt class="docutils literal"><span class="pre">boost/graph/distributed/betweenness_centrality.hpp</span></tt>&gt;</p>
  96. </div>
  97. <div class="section" id="parameters">
  98. <h1><a class="toc-backref" href="#id2">Parameters</a></h1>
  99. <dl class="docutils">
  100. <dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">ProcessGroup&amp;</span> <span class="pre">pg</span></tt></dt>
  101. <dd>The process group over which the the processes involved in
  102. betweenness centrality communicate. The process group type must
  103. model the <a class="reference external" href="process_group.html">Process Group</a> concept.</dd>
  104. <dt>IN: <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Graph&amp;</span> <span class="pre">g</span></tt></dt>
  105. <dd>The graph type must be a model of the <a class="reference external" href="http://www.boost.org/libs/graph/doc/IncidenceGraph.html">Incidence Graph</a> concept.</dd>
  106. <dt>IN: <tt class="docutils literal"><span class="pre">CentralityMap</span> <span class="pre">centrality</span></tt></dt>
  107. <dd><p class="first">A centrality map may be supplied to the algorithm, if one is not
  108. supplied a <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt> will be used and no vertex
  109. centrality information will be recorded. The key type of the
  110. <tt class="docutils literal"><span class="pre">CentralityMap</span></tt> must be the graph's vertex descriptor type.</p>
  111. <p class="last"><strong>Default</strong>: A <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>.</p>
  112. </dd>
  113. <dt>IN: <tt class="docutils literal"><span class="pre">EdgeCentralityMap</span> <span class="pre">edge_centrality_map</span></tt></dt>
  114. <dd><p class="first">An edge centrality map may be supplied to the algorithm, if one is
  115. not supplied a <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt> will be used and no edge
  116. centrality information will be recorded. The key type of the
  117. <tt class="docutils literal"><span class="pre">EdgeCentralityMap</span></tt> must be the graph's vertex descriptor type.</p>
  118. <p class="last"><strong>Default</strong>: A <tt class="docutils literal"><span class="pre">dummy_property_map</span></tt>.</p>
  119. </dd>
  120. <dt>IN: <tt class="docutils literal"><span class="pre">IncomingMap</span> <span class="pre">incoming</span></tt></dt>
  121. <dd><p class="first">The incoming map contains the incoming edges to a vertex that are
  122. part of shortest paths to that vertex. Its key type must be the
  123. graph's vertex descriptor type and its value type must be the
  124. graph's edge descriptor type.</p>
  125. <dl class="last docutils">
  126. <dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
  127. <dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of <tt class="docutils literal"><span class="pre">std::vector</span></tt> of the graph's edge descriptor
  128. type.</dd>
  129. </dl>
  130. </dd>
  131. <dt>IN: <tt class="docutils literal"><span class="pre">DistanceMap</span> <span class="pre">distance</span></tt></dt>
  132. <dd><p class="first">The distance map records the distance to vertices during the
  133. shortest paths portion of the algorithm. Its key type must be the
  134. graph's vertex descriptor type.</p>
  135. <dl class="last docutils">
  136. <dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
  137. <dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the value type of the <tt class="docutils literal"><span class="pre">CentralityMap</span></tt>.</dd>
  138. </dl>
  139. </dd>
  140. <dt>IN: <tt class="docutils literal"><span class="pre">DependencyMap</span> <span class="pre">dependency</span></tt></dt>
  141. <dd><p class="first">The dependency map records the dependency of each vertex during the
  142. centrality calculation portion of the algorithm. Its key type must
  143. be the graph's vertex descriptor type.</p>
  144. <dl class="last docutils">
  145. <dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
  146. <dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the value type of the <tt class="docutils literal"><span class="pre">CentralityMap</span></tt>.</dd>
  147. </dl>
  148. </dd>
  149. <dt>IN: <tt class="docutils literal"><span class="pre">PathCountMap</span> <span class="pre">path_count</span></tt></dt>
  150. <dd><p class="first">The path count map records the number of shortest paths each vertex
  151. is on during the centrality calculation portion of the algorithm.
  152. Its key type must be the graph's vertex descriptor type.</p>
  153. <dl class="last docutils">
  154. <dt><strong>Default</strong>: An <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt> created from a</dt>
  155. <dd><tt class="docutils literal"><span class="pre">std::vector</span></tt> of the graph's degree size type.</dd>
  156. </dl>
  157. </dd>
  158. <dt>IN: <tt class="docutils literal"><span class="pre">VertexIndexMap</span> <span class="pre">vertex_index</span></tt></dt>
  159. <dd><p class="first">A model of <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the vertex
  160. descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt> and whose value type is an
  161. integral type. The property map should map from vertices to their
  162. (local) indices in the range <em>[0, num_vertices(g))</em>.</p>
  163. <p class="last"><strong>Default</strong>: <tt class="docutils literal"><span class="pre">get(vertex_index,</span> <span class="pre">g)</span></tt></p>
  164. </dd>
  165. <dt>IN: <tt class="docutils literal"><span class="pre">WeightMap</span> <span class="pre">weight_map</span></tt></dt>
  166. <dd>A model of <a class="reference external" href="http://www.boost.org/libs/property_map/ReadablePropertyMap.html">Readable Property Map</a> whose key type is the edge
  167. descriptor type of the graph <tt class="docutils literal"><span class="pre">g</span></tt>. If not supplied the betweenness
  168. centrality calculation will be unweighted.</dd>
  169. <dt>IN: <tt class="docutils literal"><span class="pre">Buffer</span> <span class="pre">sources</span></tt></dt>
  170. <dd><p class="first">A model of <a class="reference external" href="http://www.boost.org/libs/graph/doc/Buffer.html">Buffer</a> containing the starting vertices for the
  171. algorithm. If <tt class="docutils literal"><span class="pre">sources</span></tt> is empty a complete betweenness
  172. centrality calculation using all vertices in <tt class="docutils literal"><span class="pre">g</span></tt> will be
  173. performed. The value type of the Buffer must be the graph's vertex
  174. descriptor type.</p>
  175. <p class="last"><strong>Default</strong>: An empty <tt class="docutils literal"><span class="pre">boost::queue</span></tt> of int.</p>
  176. </dd>
  177. </dl>
  178. </div>
  179. <div class="section" id="complexity">
  180. <h1><a class="toc-backref" href="#id3">Complexity</a></h1>
  181. <p>Each of the shortest paths calculations is <em>O(V log V)</em> and each of
  182. them may be run in parallel (one per process in <tt class="docutils literal"><span class="pre">pg</span></tt>). The
  183. reduction phase to calculate the total centrality at the end of the
  184. shortest paths phase is <em>O(V log V)</em>.</p>
  185. </div>
  186. <div class="section" id="algorithm-description">
  187. <h1><a class="toc-backref" href="#id4">Algorithm Description</a></h1>
  188. <p>The algorithm uses a non-distributed (sequential) graph, as well as
  189. non-distributed property maps. Each process contains a separate copy
  190. of the sequential graph <tt class="docutils literal"><span class="pre">g</span></tt>. In order for the algorithm to be
  191. correct, these copies of <tt class="docutils literal"><span class="pre">g</span></tt> must be identical. The <tt class="docutils literal"><span class="pre">sources</span></tt>
  192. buffer contains the vertices to use as the source of single source
  193. shortest paths calculations when approximating betweenness centrality
  194. using a subset of the vertices in the graph. If <tt class="docutils literal"><span class="pre">sources</span></tt> is empty
  195. then a complete betweenness centrality calculation is performed using
  196. all vertices.</p>
  197. <p>In the sequential phase of the algorithm each process computes
  198. shortest paths from a subset of the vertices in the graph using the
  199. Brandes shortest paths methods from the BGL's betweenness centrality
  200. implementation. In the parallel phase of the algorithm a reduction is
  201. performed to sum the values computed by each process for all vertices
  202. in the graph.</p>
  203. <p>Either weighted or unweighted betweenness centrality is calculated
  204. depending on whether a <tt class="docutils literal"><span class="pre">WeightMap</span></tt> is passed.</p>
  205. <hr class="docutils" />
  206. <p>Copyright (C) 2009 The Trustees of Indiana University.</p>
  207. <p>Authors: Nick Edmonds and Andrew Lumsdaine</p>
  208. </div>
  209. </div>
  210. <div class="footer">
  211. <hr class="footer" />
  212. Generated on: 2009-05-31 00:22 UTC.
  213. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
  214. </div>
  215. </body>
  216. </html>