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