is_kuratowski_subgraph.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <html><head><!-- Copyright 2007 Aaron Windsor
  2. Distributed under the Boost Software License, Version 1.0.
  3. (See accompanying file LICENSE_1_0.txt or copy at
  4. http://www.boost.org/LICENSE_1_0.txt)
  5. -->
  6. <title>Boost Graph Library: is_kuratowski_subgraph</title>
  7. </head>
  8. <body alink="#ff0000"
  9. bgcolor="#ffffff"
  10. link="#0000ee"
  11. text="#000000"
  12. vlink="#551a8b">
  13. <img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
  14. <br clear="">
  15. <h1><tt>is_kuratowski_subgraph</tt></h1>
  16. <pre>template &lt;typename Graph, typename ForwardIterator, typename VertexIndexMap&gt;
  17. bool is_kuratowski_subgraph(const Graph&amp; g, ForwardIterator begin, ForwardIterator end, VertexIndexMap vm)
  18. </pre>
  19. <p>
  20. <tt>is_kuratowski_subgraph(g, begin, end)</tt> returns <tt>true</tt> exactly
  21. when the sequence of edges defined by the range <tt>[begin, end)</tt> forms a
  22. <a href="./planar_graphs.html#kuratowskisubgraphs"> Kuratowski subgraph</a> in
  23. the graph <tt>g</tt>. If you need to verify that an arbitrary graph has a
  24. <i>K<sub>5</sub></i> or <i>K<sub>3,3</sub></i> minor, you should use the
  25. function <tt><a href="boyer_myrvold.html">boyer_myrvold_planarity_test</a></tt>
  26. to isolate such a minor instead of this function. <tt>is_kuratowski_subgraph
  27. </tt> exists to aid in testing and verification of the function
  28. <tt>boyer_myrvold_planarity_test</tt>, and for that reason, it expects its
  29. input to be a restricted set of edges forming a Kuratowski subgraph, as
  30. described in detail below.
  31. <p>
  32. <tt>is_kuratowski_subgraph</tt> creates a temporary graph out of the sequence
  33. of edges given and repeatedly contracts edges until it ends up with a graph
  34. with either all edges of degree 3 or all edges of degree 4. The final
  35. contracted graph is then checked against <i>K<sub>5</sub></i> or
  36. <i>K<sub>3,3</sub></i> using the Boost Graph Library's
  37. <a href="isomorphism.html">isomorphism</a>
  38. function. The contraction process starts by choosing edges adjacent to a vertex
  39. of degree 1 and contracting those. When none are left, it moves on to edges
  40. adjacent to a vertex of degree 2. If only degree 3 vertices are left after this
  41. stage, the graph is checked against <i>K<sub>3,3</sub></i>. Otherwise, if
  42. there's at least one degree 4 vertex, edges adjacent to degree 3 vertices are
  43. contracted as neeeded and the final graph is compared to <i>K<sub>5</sub></i>.
  44. <p>
  45. In order for this process to be deterministic, we make the following two
  46. restrictions on the input graph given to <tt>is_kuratowski_subgraph</tt>:
  47. <ol>
  48. <li>No edge contraction needed to produce a kuratowski subgraph results in
  49. multiple edges between the same pair of vertices (No edge <i>{a,b}</i> will be
  50. contracted at any point in the contraction process if <i>a</i> and <i>b</i>
  51. share a common neighbor.)
  52. </li><li>If the graph contracts to a <i>K<sub>5</sub></i>, once the graph has
  53. been contracted to only vertices of degree at least 3, no cycles exist that
  54. contain solely degree 3 vertices.
  55. </li></ol>
  56. The second restriction is needed both to discriminate between targeting a
  57. <i>K<sub>5</sub></i> or a <i>K<sub>3,3</sub></i> and to determinstically
  58. contract the vertices of degree 4 once the <i>K<sub>5</sub></i> has been
  59. targeted. The Kuratowski subgraph output by the function <tt>
  60. <a href="boyer_myrvold.html">boyer_myrvold_planarity_test</a></tt> is
  61. guaranteed to meet both of the above requirements.
  62. <h3>Complexity</h3>
  63. On a graph with <i>n</i> vertices, this function runs in time <i>O(n)</i>.
  64. <h3>Where Defined</h3>
  65. <p>
  66. <a href="../../../boost/graph/is_kuratowski_subgraph.hpp">
  67. <tt>boost/graph/is_kuratowski_subgraph.hpp</tt>
  68. </a>
  69. </p><h3>Parameters</h3>
  70. IN: <tt>Graph&amp; g</tt>
  71. <blockquote>
  72. An undirected graph with no self-loops or parallel edges. The graph type must
  73. be a model of <a href="VertexListGraph.html">Vertex List Graph</a>.
  74. </blockquote>
  75. IN: <tt>ForwardIterator</tt>
  76. <blockquote>
  77. A ForwardIterator with value_type
  78. <tt>graph_traits&lt;Graph&gt;::edge_descriptor</tt>.
  79. </blockquote>
  80. IN: <tt>VertexIndexMap vm</tt>
  81. <blockquote>
  82. A <a href="../../property_map/doc/ReadablePropertyMap.html">Readable Property Map
  83. </a> that maps vertices from <tt>g</tt> to distinct integers in the range
  84. <tt>[0, num_vertices(g) )</tt><br>
  85. <b>Default</b>: <tt>get(vertex_index,g)</tt><br>
  86. </blockquote>
  87. <h3>Example</h3>
  88. <p>
  89. <a href="../example/kuratowski_subgraph.cpp">
  90. <tt>examples/kuratowski_subgraph.cpp</tt>
  91. </a>
  92. </p><h3>See Also</h3>
  93. <p>
  94. <a href="planar_graphs.html">Planar Graphs in the Boost Graph Library</a>
  95. <br>
  96. </p><hr>
  97. Copyright © 2007 Aaron Windsor (<a href="mailto:aaron.windsor@gmail.com">
  98. aaron.windsor@gmail.com</a>)
  99. </body></html>