In graph theory, the planarity testing problem is the algorithmic problem of testing whether a given graph is a planar graph (that is, whether it can be drawn in the plane without edge intersections). This is a well-studied problem in computer science for which many practical algorithms have emerged, many taking advantage of novel data structures. Most of these methods operate in O(n) time (linear time), where n is the number of edges (or vertices) in the graph, which is asymptotically optimal. Rather than just being a single Boolean value, the output of a planarity testing algorithm may be a planar graph embedding, if the graph is planar, or an obstacle to planarity such as a Kuratowski subgraph if it is not.
Planarity criteria
editPlanarity testing algorithms typically take advantage of theorems in graph theory that characterize the set of planar graphs in terms that are independent of graph drawings. These include
- Kuratowski's theorem that a graph is planar if and only if it does not contain a subgraph that is a subdivision of K5 (the complete graph on five vertices) or K3,3 (the utility graph, a complete bipartite graph on six vertices, three of which connect to each of the other three).
- Wagner's theorem that a graph is planar if and only if it does not contain a minor (subgraph of a contraction) that is isomorphic to K5 or K3,3.
- The Fraysseix–Rosenstiehl planarity criterion, characterizing planar graphs in terms of a left-right ordering of the edges in a depth-first search tree.
The Fraysseix–Rosenstiehl planarity criterion can be used directly as part of algorithms for planarity testing, while Kuratowski's and Wagner's theorems have indirect applications: if an algorithm can find a copy of K5 or K3,3 within a given graph, it can be sure that the input graph is not planar and return without additional computation.
Other planarity criteria, that characterize planar graphs mathematically but are less central to planarity testing algorithms, include:
- Whitney's planarity criterion that a graph is planar if and only if its graphic matroid is also cographic,
- Mac Lane's planarity criterion characterizing planar graphs by the bases of their cycle spaces,
- Schnyder's theorem characterizing planar graphs by the order dimension of an associated partial order, and
- Colin de Verdière's planarity criterion using spectral graph theory.
Algorithms
editPath addition method
editThe classic path addition method of Hopcroft and Tarjan[1] was the first published linear-time planarity testing algorithm in 1974. An implementation of Hopcroft and Tarjan's algorithm is provided in the Library of Efficient Data types and Algorithms by Mehlhorn, Mutzel and Näher.[2][3][4] In 2012, Taylor[5] extended this algorithm to generate all permutations of cyclic edge-order for planar embeddings of biconnected components.
Vertex addition method
editVertex addition methods work by maintaining a data structure representing the possible embeddings of an induced subgraph of the given graph, and adding vertices one at a time to this data structure. These methods began with an inefficient O(n2) method conceived by Lempel, Even and Cederbaum in 1967.[6] It was improved by Even and Tarjan, who found a linear-time solution for the s,t-numbering step,[7] and by Booth and Lueker, who developed the PQ tree data structure. With these improvements it is linear-time and outperforms the path addition method in practice.[8] This method was also extended to allow a planar embedding (drawing) to be efficiently computed for a planar graph.[9] In 1999, Shih and Hsu simplified these methods using the PC tree (an unrooted variant of the PQ tree) and a postorder traversal of the depth-first search tree of the vertices.[10]
Edge addition method
editIn 2004, John Boyer and Wendy Myrvold[11] developed a simplified O(n) algorithm, originally inspired by the PQ tree method, which gets rid of the PQ tree and uses edge additions to compute a planar embedding, if possible. Otherwise, a Kuratowski subdivision (of either K5 or K3,3) is computed. This is one of the two current state-of-the-art algorithms today (the other one is the planarity testing algorithm of de Fraysseix, Ossona de Mendez and Rosenstiehl[12][13]). See [14] for an experimental comparison with a preliminary version of the Boyer and Myrvold planarity test. Furthermore, the Boyer–Myrvold test was extended to extract multiple Kuratowski subdivisions of a non-planar input graph in a running time linearly dependent on the output size.[15] The source code for the planarity test[16][17] and the extraction of multiple Kuratowski subdivisions[16] is publicly available. Algorithms that locate a Kuratowski subgraph in linear time in vertices were developed by Williamson in the 1980s.[18]
Construction sequence method
editA different method uses an inductive construction of 3-connected graphs to incrementally build planar embeddings of every 3-connected component of G (and hence a planar embedding of G itself).[19] The construction starts with K4 and is defined in such a way that every intermediate graph on the way to the full component is again 3-connected. Since such graphs have a unique embedding (up to flipping and the choice of the external face), the next bigger graph, if still planar, must be a refinement of the former graph. This allows to reduce the planarity test to just testing for each step whether the next added edge has both ends in the external face of the current embedding. While this is conceptually very simple (and gives linear running time), the method itself suffers from the complexity of finding the construction sequence.
Dynamic algorithms
editPlanarity testing has been studied in the Dynamic Algorithms model, in which one maintains an answer to a problem (in this case planarity) as the graph undergoes local updates, typically in the form of insertion/deletion of edges. In the edge-arrival case, there is an asympotically tight inverse-Ackermann function update-time algorithm due to La Poutré,[20] improving upon algorithms by Di Battista, Tamassia, and Westbrook.[21][22][23] In the fully-dynamic case where edges are both inserted and deleted, there is a logarithmic update-time lower bound by Pătrașcu and Demaine,[24] and a polylogarithmic update-time algorithm by Holm and Rotenberg,[25] improving on sub-linear update-time algorithms by Eppstein, Galil, Italiano, Sarnak, and Spencer.[26][27]
References
edit- ^ Hopcroft, John; Tarjan, Robert E. (1974), "Efficient planarity testing", Journal of the Association for Computing Machinery, 21 (4): 549–568, doi:10.1145/321850.321852, hdl:1813/6011, S2CID 6279825.
- ^ Mehlhorn, Kurt; Mutzel, Petra (1996), "On the Embedding Phase of the Hopcroft and Tarjan Planarity Testing Algorithm" (PDF), Algorithmica, 16 (2): 233–242, doi:10.1007/bf01940648, hdl:11858/00-001M-0000-0014-B51D-B, S2CID 10014462
- ^ Mehlhorn, Kurt; Mutzel, Petra; Näher, Stefan (1993), An Implementation of the Hopcroft and Tarjan Planarity Test and Embedding Algorithm
- ^ Mehlhorn, Kurt; Näher, Stefan (1995), "LEDA: A library of efficient data types and algorithms", Communications of the ACM, 38 (1): 96–102, CiteSeerX 10.1.1.54.9556, doi:10.1145/204865.204889, S2CID 2560175
- ^ Taylor, Martyn G. (2012). Planarity Testing by Path Addition (Ph.D.). University of Kent. Archived from the original on 2016-03-05. Alt URL
- ^ Lempel, A.; Even, S.; Cederbaum, I. (1967), "An algorithm for planarity testing of graphs", in Rosenstiehl, P. (ed.), Theory of Graphs, New York: Gordon and Breach, pp. 215–232.
- ^ Even, Shimon; Tarjan, Robert E. (1976), "Computing an st-numbering", Theoretical Computer Science, 2 (3): 339–344, doi:10.1016/0304-3975(76)90086-4.
- ^ Boyer & Myrvold (2004), p. 243: “Its implementation in LEDA is slower than LEDA implementations of many other O(n)-time planarity algorithms.”
- ^ Chiba, N.; Nishizeki, T.; Abe, A.; Ozawa, T. (1985), "A linear algorithm for embedding planar graphs using PQ–trees", Journal of Computer and System Sciences, 30 (1): 54–76, doi:10.1016/0022-0000(85)90004-2.
- ^ Shih, W. K.; Hsu, W. L. (1999), "A new planarity test", Theoretical Computer Science, 223 (1–2): 179–191, doi:10.1016/S0304-3975(98)00120-0.
- ^ Boyer, John M.; Myrvold, Wendy J. (2004), "On the cutting edge: simplified O(n) planarity by edge addition" (PDF), Journal of Graph Algorithms and Applications, 8 (3): 241–273, doi:10.7155/jgaa.00091.
- ^ de Fraysseix, H.; Ossona de Mendez, P.; Rosenstiehl, P. (2006), "Trémaux Trees and Planarity", International Journal of Foundations of Computer Science, 17 (5): 1017–1030, arXiv:math/0610935, Bibcode:2006math.....10935D, doi:10.1142/S0129054106004248, S2CID 40107560.
- ^ Brandes, Ulrik (2009), The left-right planarity test (PDF).
- ^ Boyer, John M.; Cortese, P. F.; Patrignani, M.; Battista, G. D. (2003), "Stop minding your P's and Q's: implementing a fast and simple DFS-based planarity testing and embedding algorithm", Proc. 11th Int. Symp. Graph Drawing (GD '03), Lecture Notes in Computer Science, vol. 2912, Springer-Verlag, pp. 25–36
- ^ Chimani, M.; Mutzel, P.; Schmidt, J. M. (2008). "Efficient extraction of multiple Kuratowski subdivisions". Proc. 15th Int. Symp. Graph Drawing (GD'07). Lecture Notes in Computer Science. Vol. 4875. Sydney, Australia: Springer-Verlag. pp. 159–170. doi:10.1007/978-3-540-77537-9_17. ISBN 978-3-540-77536-2..
- ^ a b "OGDF - Open Graph Drawing Framework: Start".
- ^ "Boost Graph Library: Boyer-Myrvold Planarity Testing/Embedding - 1.40.0".
- ^ Williamson, S. G. (1984), "Depth First Search and Kuratowski Subgraphs", Journal of the ACM, 31 (4): 681–693, doi:10.1145/1634.322451, S2CID 8348222
- ^ Schmidt, Jens M. (2014), "The Mondshein Sequence", Automata, Languages, and Programming; Proceedings of the 41st International Colloquium on Automata, Languages and Programming (ICALP'14), Lecture Notes in Computer Science, vol. 8572, pp. 967–978, doi:10.1007/978-3-662-43948-7_80, ISBN 978-3-662-43947-0
- ^ La Poutré, Johannes A. (1994), "Alpha algorithms for incremental planarity testing", Proceedings of the Twenty-Sixth Annual ACM Symposium on Theory of Computing (STOC), pp. 706–715, doi:10.1145/195058.195439, S2CID 16799743
- ^ Di Battista, Giuseppe; Tamassia, Roberto (1996), "on-line maintenance of triconnected components with SPQR-trees", Algorithmica, 15 (4): 302–318, doi:10.1007/BF01961541, S2CID 7838334
- ^ Tamassia, Roberto (1996), "On-line planar graph embedding", Journal of Algorithms, 21 (2): 201–239, doi:10.1006/jagm.1996.0044
- ^ Westbrook, Jeffery (1992), "Fast Incremental Planarity Testing", Automata, Languages and Programming, 19th International Colloquium, ICALP92, doi:10.1007/3-540-55719-9_86
- ^ Pătrașcu, Mihai; Demaine, Erik (2004), "Lower Bounds for Dynamic Connectivity", Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 546–553, doi:10.1145/1007352.1007435, ISBN 1581138520, S2CID 2121130
- ^ Holm, Jacob; Rotenberg, Eva (2020). "Fully-dynamic planarity testing in polylogarithmic time". In Makarychev, Konstantin; Makarychev, Yury; Tulsiani, Madhur; Kamath, Gautam; Chuzhoy, Julia (eds.). Proceedings of the 52nd Annual ACM SIGACT Symposium on Theory of Computing, STOC 2020, Chicago, IL, USA, June 22-26, 2020. Association for Computing Machinery. pp. 167–180. arXiv:1911.03449. doi:10.1145/3357713.3384249.
- ^ Eppstein, David; Galil, Zvi; Italiano, Giuseppe; Spencer, Thomas (1996), "Separator based sparsification: I. planarity testing and minimum spanning trees", Journal of Computer and System Sciences, doi:10.1006/jcss.1996.0002
- ^ Galil, Zvi; Italiano, Giuseppe; Sarnak, Neil (1999), "Fully dynamic planarity testing with applications", Journal of the ACM, 46: 28–91, doi:10.1145/300515.300517, S2CID 7009330