minimum_degree_ordering.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <HTML>
  2. <!--
  3. Copyright (c) Lie-Quan Lee and Jeremy Siek, 2001
  4. Distributed under the Boost Software License, Version 1.0.
  5. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. -->
  8. <Head>
  9. <Title>Boost Graph Library: Minimum Degree Ordering</Title>
  10. <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
  11. ALINK="#ff0000">
  12. <IMG SRC="../../../boost.png"
  13. ALT="C++ Boost" width="277" height="86">
  14. <BR Clear>
  15. <H1><A NAME="sec:mmd">
  16. <img src="figs/python.gif" alt="(Python)"/>
  17. <TT>minimum_degree_ordering</TT>
  18. </H1>
  19. <pre>
  20. template &lt;class AdjacencyGraph, class OutDegreeMap,
  21. class InversePermutationMap,
  22. class PermutationMap, class SuperNodeSizeMap, class VertexIndexMap&gt;
  23. void minimum_degree_ordering
  24. (AdjacencyGraph& G,
  25. OutDegreeMap outdegree,
  26. InversePermutationMap inverse_perm,
  27. PermutationMap perm,
  28. SuperNodeSizeMap supernode_size, int delta, VertexIndexMap id)
  29. </pre>
  30. <p>The minimum degree ordering algorithm&nbsp;[<A
  31. HREF="bibliography.html#LIU:MMD">21</A>, <A
  32. href="bibliography.html#George:evolution">35</a>] is a fill-in
  33. reduction matrix reordering algorithm. When solving a system of
  34. equations such as <i>A x = b</i> using a sparse version of Cholesky
  35. factorization (which is a variant of Gaussian elimination for
  36. symmetric matrices), often times elements in the matrix that were once
  37. zero become non-zero due to the elimination process. This is what is
  38. referred to as &quot;fill-in&quot;, and fill-in is bad because it
  39. makes the matrix less sparse and therefore consume more time and space
  40. in later stages of the elimintation and in computations that use the
  41. resulting factorization. Now it turns out that reordering the rows of
  42. a matrix can have a dramatic affect on the amount of fill-in that
  43. occurs. So instead of solving <i>A x = b</i>, we instead solve the
  44. reordered (but equivalent) system <i>(P A P<sup>T</sup>)(P x) = P
  45. b</i>. Finding the optimal ordering is an NP-complete problem (e.i.,
  46. it can not be solved in a reasonable amount of time) so instead we
  47. just find an ordering that is &quot;good enough&quot; using
  48. heuristics. The minimum degree ordering algorithm is one such
  49. approach.
  50. <p>
  51. A symmetric matrix <TT>A</TT> is typically represented with an
  52. undirected graph, however for this function we require the input to be
  53. a directed graph. Each nonzero matrix entry <TT>A(i, j)</TT> must be
  54. represented by two directed edges (<TT>e(i,j)</TT> and
  55. <TT>e(j,i)</TT>) in <TT>G</TT>.
  56. <p>
  57. The output of the algorithm are the vertices in the new ordering.
  58. <pre>
  59. inverse_perm[new_index[u]] == old_index[u]
  60. </pre>
  61. <p> and the permutation from the old index to the new index.
  62. <pre>
  63. perm[old_index[u]] == new_index[u]
  64. </pre>
  65. <p>The following equations are always held.
  66. <pre>
  67. for (size_type i = 0; i != inverse_perm.size(); ++i)
  68. perm[inverse_perm[i]] == i;
  69. </pre>
  70. <h3>Parameters</h3>
  71. <ul>
  72. <li> <tt>AdjacencyGraph&amp; G</tt> &nbsp;(IN) <br>
  73. A directed graph. The graph's type must be a model of <a
  74. href="./AdjacencyGraph.html">Adjacency Graph</a>,
  75. <a
  76. href="./VertexListGraph.html">Vertex List Graph</a>,
  77. <a href="./IncidenceGraph.html">Incidence Graph</a>,
  78. and <a href="./MutableGraph.html">Mutable Graph</a>.
  79. In addition, the functions <tt>num_vertices()</tt> and
  80. <TT>out_degree()</TT> are required.
  81. <li> <tt>OutDegreeMap outdegree</tt> &nbsp(WORK) <br>
  82. This is used internally to store the out degree of vertices. This
  83. must be a <a href="../../property_map/doc/LvaluePropertyMap.html">
  84. LvaluePropertyMap</a> with key type the same as the vertex
  85. descriptor type of the graph, and with a value type that is an
  86. integer type.
  87. <li> <tt>InversePermutationMap inverse_perm</tt> &nbsp(OUT) <br>
  88. The new vertex ordering, given as the mapping from the
  89. new indices to the old indices (an inverse permutation).
  90. This must be an <a href="../../property_map/doc/LvaluePropertyMap.html">
  91. LvaluePropertyMap</a> with a value type and key type a signed integer.
  92. <li> <tt>PermutationMap perm</tt> &nbsp(OUT) <br>
  93. The new vertex ordering, given as the mapping from the
  94. old indices to the new indices (a permutation).
  95. This must be an <a href="../../property_map/doc/LvaluePropertyMap.html">
  96. LvaluePropertyMap</a> with a value type and key type a signed integer.
  97. <li> <tt>SuperNodeSizeMap supernode_size</tt> &nbsp(WORK/OUT) <br>
  98. This is used internally to record the size of supernodes and is also
  99. useful information to have. This is a <a
  100. href="../../property_map/doc/LvaluePropertyMap.html">
  101. LvaluePropertyMap</a> with an unsigned integer value type and key
  102. type of vertex descriptor.
  103. <li> <tt>int delta</tt> &nbsp(IN) <br>
  104. Multiple elimination control variable. If it is larger than or equal
  105. to zero then multiple elimination is enabled. The value of
  106. <tt>delta</tt> specifies the difference between the minimum degree
  107. and the degree of vertices that are to be eliminated.
  108. <li> <tt>VertexIndexMap id</tt> &nbsp(IN) <br>
  109. Used internally to map vertices to their indices. This must be a <a
  110. href="../../property_map/doc/ReadablePropertyMap.html"> Readable
  111. Property Map</a> with key type the same as the vertex descriptor of
  112. the graph and a value type that is some unsigned integer type.
  113. </ul>
  114. <h3>Example</h3>
  115. See <a
  116. href="../example/minimum_degree_ordering.cpp"><tt>example/minimum_degree_ordering.cpp</tt></a>.
  117. <h3>Implementation Notes</h3>
  118. <p>UNDER CONSTRUCTION
  119. <p>It chooses the vertex with minimum degree in the graph at each step of
  120. simulating Gaussian elimination process.
  121. <p>This implementation provided a number of enhancements
  122. including mass elimination, incomplete degree update, multiple
  123. elimination, and external degree. See&nbsp;[<A
  124. href="bibliography.html#George:evolution">35</a>] for a historical
  125. survey of the minimum degree algorithm.
  126. <p>
  127. An <b>elimination graph</b> <i>G<sub>v</sub></i> is obtained from the
  128. graph <i>G</i> by removing vertex <i>v</i> and all of its incident
  129. edges and by then adding edges to make all of the vertices adjacent to
  130. <i>v</i> into a clique (that is, add an edge between each pair of
  131. adjacent vertices if an edge doesn't already exist).
  132. Suppose that graph <i>G</i> is the graph representing the nonzero
  133. structure of a matrix <i>A</i>. Then performing a step of Guassian
  134. elimination on row <i>i</i> of matrix <i>A</i> is equivalent to
  135. <br>
  136. <HR>
  137. <TABLE>
  138. <TR valign=top>
  139. <TD nowrap>Copyright &copy; 2001</TD><TD>
  140. <A HREF="http://www.boost.org/people/liequan_lee.htm">Lie-Quan Lee</A>, Indiana University (<A HREF="mailto:llee@cs.indiana.edu">llee@cs.indiana.edu</A>) <br>
  141. <A HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</A>, Indiana University (<A HREF="mailto:jsiek@osl.iu.edu">jsiek@osl.iu.edu</A>)
  142. </TD></TR></TABLE>
  143. </BODY>
  144. </HTML>