PlanarEmbedding.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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>Planar Embedding Concept</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>Planar Embedding Concept</h1>
  16. A planar embedding is an important intermediate representation of a drawing
  17. of a planar graph. Instead of specifying the absolute positions of the vertices
  18. and edges in the plane, a planar embedding specifies their positions relative
  19. to one another. A planar embedding consists of a sequence, for each vertex in
  20. the graph, of all of the edges incident on that vertex in the order in which
  21. they are to be drawn around that vertex.
  22. <p>
  23. A planar embedding is a refinement of
  24. <a href="../../property_map/doc/LvaluePropertyMap.html">LValuePropertyMap</a> that
  25. places additional restrictions the <tt>value_type</tt> used in the property
  26. map.
  27. </p><h3>Notation</h3>
  28. <table>
  29. <tbody>
  30. <tr>
  31. <td> <tt>Embedding</tt> </td>
  32. <td> is a type that models the Planar Embedding concept.</td>
  33. </tr>
  34. <tr>
  35. <td> <tt>embedding</tt> </td>
  36. <td> is an object of type <tt>Embedding</tt>. </td>
  37. </tr>
  38. <tr>
  39. <td> <tt>Graph</tt> </td>
  40. <td> is the type of the underlying graph.</td>
  41. </tr>
  42. <tr>
  43. <td> <tt>e</tt> </td>
  44. <td> is an object of type <tt>graph_traits&lt;Graph&gt;::edge_descriptor</tt>.
  45. </td>
  46. </tr>
  47. <tr>
  48. <td> <tt>v</tt> </td>
  49. <td> is an object of type <tt>graph_traits&lt;Graph&gt;::vertex_descriptor
  50. </tt>.</td>
  51. </tr><tr>
  52. <td>
  53. </td></tr></tbody></table>
  54. <h3>Associated Types</h3>
  55. <table border="1">
  56. <tbody><tr>
  57. <td> Const Iterator </td>
  58. <td> <tt>boost::property_traits&lt;Embedding&gt;::value_type::const_iterator
  59. </tt>
  60. </td>
  61. <td> The iterator type used to iterate over the ordering of the edges in the
  62. planar embedding of a particular vertex
  63. </td>
  64. </tr>
  65. </tbody></table>
  66. <h3>Valid Expressions</h3>
  67. <p>
  68. <table border="1">
  69. <tbody><tr><th>Expression</th><th>Return Type</th><th>Description</th>
  70. </tr><tr>
  71. <td> <tt>embedding[v].begin()</tt> </td>
  72. <td> <tt>boost::property_traits&lt;Embedding&gt;::value_type::const_iterator
  73. </tt></td>
  74. <td> Returns an iterator to the beginning of the range of edges in the
  75. embedding around vertex v</td>
  76. </tr>
  77. <tr>
  78. <td> <tt>embedding[v].end()</tt> </td>
  79. <td> <tt>boost::property_traits&lt;Embedding&gt;::value_type::const_iterator
  80. </tt></td>
  81. <td> Returns an iterator to the end of the range of edges in the
  82. embedding around vertex v</td>
  83. </tr>
  84. <tr>
  85. <td> <tt>embedding[v].clear()</tt> </td>
  86. <td> <tt>void</tt></td>
  87. <td> Clears all edges in the embedding around a vertex <tt>v</tt></td>
  88. </tr>
  89. <tr>
  90. <td> <tt>embedding[v].push_back(e)</tt> </td>
  91. <td> <tt>void</tt></td>
  92. <td> Adds an edge <tt>e</tt> to the end of the sequence of embedded edges
  93. around the vertex <tt>v</tt> </td>
  94. </tr>
  95. </tbody></table>
  96. </p><h3>Complexity Guarantees</h3>
  97. Starting with an empty embedding, any mixed sequence of <i>n</i> calls to a
  98. particular vertex's <tt>push_back</tt> and <tt>clear</tt> should take
  99. <i>O(n)</i> time.
  100. <h3>Models</h3>
  101. Any LValue property map that maps vertices to a <tt>std::vector</tt>,
  102. <tt>std::list</tt>, or <tt>std::deque</tt> models this
  103. concept. Below is an example of using this approach to create a model of
  104. PlanarEmbedding:
  105. <pre>
  106. #include &lt;boost/property_map/property_map.hpp&gt;
  107. #include &lt;vector&gt;
  108. ...
  109. // Assume a graph type "Graph" defined somewhere above and
  110. // an instance of Graph in a variable g.
  111. // A typedef for the storage - a vector of vectors of edge descriptors
  112. typedef
  113. std::vector&lt; std::vector&lt; graph_traits&lt;Graph&gt;::edge_descriptor &gt; &gt;
  114. planar_embedding_storage_t;
  115. // A typedef for the iterator property map, assuming the graph has
  116. // an interior vertex index map
  117. typedef
  118. boost::iterator_property_map&lt; planar_embedding_storage_t::iterator,
  119. property_map&lt;Graph, vertex_index_t&gt;::type
  120. &gt;
  121. planar_embedding_t;
  122. // Create an instance of the storage and the property map
  123. planar_embedding_storage_t planar_embedding_storage(num_vertices(g));
  124. planar_embedding_t planar_embedding(planar_embedding_storage.begin(),
  125. get(vertex_index, g)
  126. );
  127. // planar_embedding can now be passed to any function expecting a model
  128. // of PlanarEmbedding.
  129. </pre>
  130. <p>
  131. <br>
  132. </p><hr>
  133. Copyright © 2007 Aaron Windsor (<a href="mailto:aaron.windsor@gmail.com">
  134. aaron.windsor@gmail.com</a>)
  135. </body></html>