Abstract
Dujmović et al. (FOCS2019) recently proved that every planar graph G is a subgraph of \(H\boxtimes P\), where \(\boxtimes\) denotes the strong graph product, H is a graph of treewidth 8 and P is a path. This result has found numerous applications to linear graph layouts, graph colouring, and graph labelling. The proof given by Dujmović et al. is based on a similar decomposition of Pilipczuk and Siebertz (SODA2019) which is constructive and leads to an \(O(n^2)\) time algorithm for finding H and the mapping from V(G) onto \(V(H\boxtimes P)\). In this note, we show that this algorithm can be made to run in \(O(n\log n)\) time.
Similar content being viewed by others
Notes
The length of a path is equal to the number of edges in the path, which is one less than the number of vertices in the path.
References
Alon, N., Grytczuk, J., Hałuszczak, M., Riordan, O.: Nonrepetitive colorings of graphs. Random Struct. Algorithms 21(3–4), 336–346 (2002). https://doi.org/10.1002/rsa.10057
Dębski, M., Felsner, S., Micek, P., Schröder, F.: Improved bounds for centered colorings. In: Chawla, S. (ed.) Proceedings of the 2020 ACM-SIAM Symposium on Discrete Algorithms, SODA 2020, Salt Lake City, UT, USA, January 5–8, 2020, pp. 2212–2226. SIAM (2020). https://doi.org/10.1137/1.9781611975994.136
Diestel, R.: Graph Theory, Fifth Edition, volume 173 of Graduate texts in mathematics. Springer, Berlin (2017). https://doi.org/10.1007/978-3-662-53622-3
Dujmović, V., Esperet, L., Joret, G., Walczak, B., Wood, D.R.: Planar graphs have bounded nonrepetitive chromatic number. In: Advances in Combinatorics, March (2020). https://doi.org/10.19086/aic.12100
Dujmović, V., Joret, G., Micek, P., Morin, P., Ueckerdt, T., Wood, D.R.: Planar graphs have bounded queue-number. In: Proceedings of 60th Annual Symposium on Foundations of Computer Science (FOCS ’19), (2019). arXiv:1904.04791
Dujmović, V., Esperet, L., Gavoille, C., Joret, G., Micek, P., Morin, P.: Adjacency labelling for planar graphs (and beyond). CoRR, abs/2003.04280, (2020), arXiv:2003.04280
Dujmović, V., Morin, P., Wood, D.R.: The structure of k-planar graphs. CoRR, abs/1907.05168, (2019), arXiv:1907.05168
Gabow, H.N., Tarjan, R.E.: A linear-time algorithm for a special case of disjoint set union. J. Comput. Syst. Sci. 30(2), 209–221 (1985). https://doi.org/10.1016/0022-0000(85)90014-5
Grigoriev, A., Bodlaender, H.L.: Algorithms for graphs embeddable with few crossings per edge. Algorithmica 49(1), 1–11 (2007). https://doi.org/10.1007/s00453-007-0010-x
Heath, L.S., Leighton, F.T., Rosenberg, A.L.: Comparing queues and stacks as mechanisms for laying out graphs. SIAM J. Discrete Math. 5(3), 398–412 (1992). https://doi.org/10.1137/0405031
Kannan, S., Naor, M., Rudich, S.: Implicit representation of graphs. In: Janos, S. (ed.) Proceedings of the 20th Annual ACM Symposium on Theory of Computing, May 2–4, 1988, Chicago, Illinois, USA, pp. 334–343. ACM (1988) https://doi.org/10.1145/62212.62244
Kannan, S., Naor, M., Rudich, S.: Implicit representation of graphs. SIAM J. Discrete Math. 5(4), 596–603 (1992). https://doi.org/10.1137/0405049
Korzhik, V.P., Mohar, B.: Minimal obstructions for 1-immersions and hardness of 1-planarity testing. J. Graph Theory 72(1), 30–71 (2013). https://doi.org/10.1002/jgt.21630
Kráľ, D., Lazic, R.: Open problems from the workshop on algorithms, logic and structure, December (2016). https://warwick.ac.uk/fac/sci/maths/people/staff/daniel_kral/alglogstr/openproblems.pdf
Mohar, B.: A linear time algorithm for embedding graphs in an arbitrary surface. SIAM J. Discrete Math. 12(1), 6–26 (1999). https://doi.org/10.1137/S089548019529248X
Nešetřil, J., de Mendez, P.O.: Tree-depth, subgraph coloring and homomorphism bounds. Eur. J. Comb. 27(6), 1022–1041 (2006). https://doi.org/10.1016/j.ejc.2005.01.010
Nešetřil, J., de Mendez, P.O.: Grad and classes with bounded expansion i. decompositions. Eur. J. Comb. 29(3), 760–776 (2008). https://doi.org/10.1016/j.ejc.2006.07.013
Pilipczuk, M. Siebertz, S.: Polynomial bounds for centered colorings on proper minor-closed graph classes. In: Timothy M.C. (ed.) Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6–9, 2019, pp. 1501–1520. SIAM, (2019). arXiv:1807.03683v2, https://doi.org/10.1137/1.9781611975482.91
Urschel, J.C., Wellens, J.: Testing k-planarity is NP-complete. CoRR, abs/1907.02104, (2020). arXiv:1907.02104
Acknowledgements
Part of this research was conducted during the Eighth Workshop on Geometry and Graphs, held at the Bellairs Research Institute, January 31–February 7, 2020. The author is grateful to the other organizers and participants for providing a stimulating research environment. The author would like to thank Vida Dujmović and our summer student Ivana Marusic. Ivana implemented the algorithm described in Sect. 2 and the algorithm described in Sect. 3. The second implementation motivated the development of the simple nearest marked ancestor data structure in Appendix A. This research was partially supported by NSERC.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix A: Data Structures
Appendix A: Data Structures
In this appendix we describe the simple data structures used by our algorithm. Devising these data structures is an exercise in the use of two standard techniques (a simple union-find data structure and the interval labelling scheme for rooted trees).
1.1 A.1: Interval Splitting
An interval splitting data structure stores an initially-empty subset S of \(\{1,\ldots ,n\}\) under the following two operations, each of which takes an integer argument \(x\in \{1,\ldots ,n\}\):
-
\(\textsc {Add}(x)\): Add x to the set S, i.e., \(S\leftarrow S\cup \{x\}\). It is a precondition of this operation that \(x\not \in S\).
-
\(\textsc {Interval}(x)\): Return the pair (i, j) where \(i=\max \{y\in S\cup \{0\}:y<x\}\) and \(j=\min \{y\in S\cup \{n+1\}:y\geqslant x\}\).
Lemma 6
There exists a data structure that preprocesses an integer n and supports the \(\textsc {Add}(x)\) and \(\textsc {Interval}(x)\) operations. The data structures uses O(n) preprocessing time, each \(\textsc {Interval}(x)\) operation runs in O(1) time and any sequence of \(\textsc {Add}(x)\) operations takes a total of \(O(n\log n)\) time.
Proof
The data structure is essentially the inverse of one of the simplest union-find data structures that represents sets as linked lists in which each node has a pointer to the head of the list.
The data structure contains an array \(a_1,\ldots ,a_n\) of pointers. For each \(x\in \{1,\ldots ,n\}\), the array entry \(a_x\) points to a memory location m storing the interval (i, j) that answers the \(\textsc {Interval}(x)\) query. In this way each \(\textsc {Interval}(x)\) query operation runs in O(1) time, as required.
The data structure is memory-efficient in the following sense: Suppose that, at some point in time \(S=\{x_1,\ldots ,x_k\}\) with \(x_1<\cdots <x_k\). and use the convention that \(x_0:=0\) and \(x_{k+1}=n+1\). Then, for each \(i\in \{0,\ldots ,k\}\), the array locations \(a_{x_{i}+1},\ldots ,a_{\min \{n,x_{i+1}\}}\) all point the same memory location m that contains the pair (i, j), \(i<x\leqslant j\) that answers the \(\textsc {Interval}(x)\) query for each value \(x\in \{x_{i}+1,\ldots ,x_{i+1}\}\). Thus, the number of distinct memory locations m used to store answers to \(\textsc {Interval}(x)\) queries is exactly \(k+1\).
To perform an \(\textsc {Add}(x)\) operation, the data structure first looks at the pair (i, j) stored at the memory location m referenced by \(a_x\). Observe that the \(j-i\) array entries \(a_{i+1},\ldots ,a_{j}\) all point to the same memory location m and let \(k:=x-i\). The data structure allocates a new memory location \(m'\) containing a pair \((i',j')\). The algorithm then makes a choice, depending on the value of k.
-
1.
If \(k\leqslant (j-i)/2\), then it sets \((i',j')\leftarrow (i,x)\), sets \((i,j)\leftarrow (x,j)\) and sets \(a_{i+1},\ldots ,a_{x}\leftarrow m'\).
-
2.
Otherwise, it sets \((i',j')\leftarrow (x,j)\), sets \((i,j)\leftarrow (i,x)\) and sets \(a_{x+1},\ldots ,a_{j}\leftarrow m'\).
It is straightforward to verify that these operations are correct.
To analyze total running time of a sequence of \(\textsc {Add}(x)\) operations, we use the potential method of amortized analysis. For each \(\ell \in \{1,\ldots ,n\}\), let \(\Phi _\ell =c\log _2(j-i)\) where (i, j) is the answer to \(\textsc {Interval}(\ell )\) and let \(\Phi =\sum _{\ell =1}^n \Phi _\ell\). Observe that \(0\leqslant \Phi _\ell \leqslant c\log _2(n+1)\) for each \(\ell \in \{1,\ldots ,n\}\), so \(0\leqslant \Phi \leqslant cn\log _2(n+1)\). Note, furthermore that the \(\textsc {Interval}(x)\) operation has no effect on \(\Phi\).
When an \(\textsc {Add}(x)\) operation runs, it updates some number z of array entries (either \(z=k\) or \(z=j-i-k\). This takes O(z) time and does not cause \(\Phi _\ell\) to increase for any \(\ell \in \{1,\ldots ,n\}\). Furthermore, this operation causes \(\Phi _\ell\) to decrease by at least c for each array entry \(a_\ell\) that is modified. Therefore, letting \(\Phi\) and \(\Phi '\) denote the value of \(\Phi\) before and after this operation, we have \(\Phi '-\Phi \leqslant -cz\). The amortized running time of this operation is therefore \(O(1+z+\Phi '-\Phi ) = O(1)\) for a sufficiently large constant c.
Therefore each \(\textsc {Add}(x)\) operation runs in O(1) amortized time, the minimum potential is 0 and the maximum potential is \(cn\log _2(n+1)\), so the total running time of any sequence of \(\textsc {Add}(x)\) operations is at most \(O(m + n\log n)\). The precondition that \(x\not \in S\) ensures that \(m\leqslant n\), so the total running time is \(O(n\log n)\). \(\square\)
1.2 A.2: Nearest Marked Ancestor
Proof of Lemma 4
The data structure is essentially the interval labelling scheme for trees combined with the interval splitting data structure from the previous section.
Let \(T'\) be the directed graph obtained by replacing each undirected edge vw of T with two directed edges vw and wv. Since every node of \(T'\) has the same in and out degree, it is Eulerian. Let \(v_1,v_2,\ldots ,v_{2n-1}\) be the sequence of vertices encountered during an Euler tour of \(T'\) that begins and ends at the root \(v_1=v_{2n-1}\) of T. For each node v of T, let \(i_v:=\min \{i:v_i=v\}\) and \(j_v:=\max \{j:v_j=v\}\). Observe that \(v_{i_v},v_{i_v+1},\ldots ,v_{j_v}\) contains exactly those nodes of T that have v as a T-ancestor.
The data structure stores the sequence \(v_0,v_1,v_2,\ldots ,v_{2n-1}\) in an array and maintains an interval splitting data structure on the set \(1,\ldots ,2n-1\). The operation of \(\textsc {Mark}(w)\) is simple: We simply call \(\textsc {Add}(i_w)\) and \(\textsc {Add}(j_w)\). Note that the precondition that \(w\not \in S\) ensures that the precondition \(x\not \in S\) of the \(\textsc {Add}(x)\) operation is satisified. Thus, any sequence of \(\textsc {Mark}(w)\) operations results in a sequence of \(\textsc {Add}(x)\) operations on the set \(\{1,\ldots ,2n-1\}\). By Lemma 6 this takes a total of \(O(n\log n)\) time, as required.
The operation of the \(\textsc {NearestMarkedAncestor}(v)\) is almost as simple. We call \(\textsc {Interval}(i_w)\) to obtain some pair (i, j) with \(i< i_w \leqslant j\). There are two cases to consider:
-
1.
If \(j=i_w\) then this is because \(w\in S\), in which case w is the nearest marked ancestor of itself.
-
2.
Otherwise, \(i<i_w<j\), and \((i,j)=(i_v,j_v)\) for some node \(v\in S\). Therefore, \(v_{i}=v_{j}\) is the nearest marked ancestor of w.
Therefore, in either case, we obtain the nearest marked ancestor of w in O(1) time, as required. \(\square\)
Rights and permissions
About this article
Cite this article
Morin, P. A Fast Algorithm for the Product Structure of Planar Graphs. Algorithmica 83, 1544–1558 (2021). https://doi.org/10.1007/s00453-020-00793-5
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-020-00793-5