A Tipping Point for the Planarity of Small and Medium Sized Graphs
AA Tipping Point for the Planarity of Small andMedium Sized Graphs (cid:63)
Emanuele Balloni, Giuseppe Di Battista, and Maurizio Patrignani
Roma Tre University, Rome, Italy [email protected] { giuseppe.dibattista,maurizio.patrignani } @uniroma3.it Abstract.
This paper presents an empirical study of the relationshipbetween the density of small-medium sized random graphs and theirplanarity. It is well known that, when the number of vertices tends toinfinite, there is a sharp transition between planarity and non-planarityfor edge density d = 0 .
5. However, this asymptotic property does notclarify what happens for graphs of reduced size. We show that an un-expectedly sharp transition is also exhibited by small and medium sizedgraphs. Also, we show that the same “tipping point” behavior can beobserved for some restrictions or relaxations of planarity (we consideredouterplanarity and near-planarity, respectively).
Keywords:
Planarity · Random graphs · Outerplanarity · Near-planarity.
Several popular Graph Drawing algorithms devised to draw graphs of small-medium size assume that the graph to be drawn is planar both in the staticsetting [17,10,16] and in the dynamic one [2,7,4]. Hence, to assess the practicalapplicability of such algorithms it is crucial to study the probability that a small-medium sized graph (say of about 100–200 vertices) is planar. In particular, itis interesting to consider how this probability varies as a function of the densityof the graph. We might have that the probability of planarity changes smoothlyor that it changes abruptly, exhibiting a tipping-point behaviour.A tipping point is a threshold that, when exceeded, leads to a sharp changein the state of a system. In sociology, for example, a tipping point is a time whenmost of the members of a group suddenly change their behavior by adopting apractice that before was considered rare. In climate study, a tipping point is aquick and irreversible change in the climate, triggered by some specific cause, likethe growth of the global mean surface temperature. Even in graph theory, tipping (cid:63)
This research was supported in part by MIUR Project “MODE” under PRIN20157EFM5C, by MIUR Project “AHeAD” under PRIN 20174LF3T8, and by RomaTre University Azione 4 Project “GeoView”. Appears in the Proceedings of the 28thInternational Symposium on Graph Drawing and Network Visualization (GD 2020). a r X i v : . [ c s . D M ] A ug E. Balloni et al.(a)
Number of vertices D e n s i t y (b) Number of vertices (c)
Number of vertices (d)
Number of vertices
Fig. 1.
Function ζ ( n, d ) for n ∈ [1 , d ∈ [0 ,
3] in four cases: (a) c =5, c =0 . c =20, c =0 .
5; (b) c =5, c =0 . c =8, c =0 .
5; (c) c =5, c =0 . c =4, c =0 .
5; and(d) c =10, c =0 . c =1, c =0 . points have been found. As an example, in 1960 Erd¨os and R`enyi establishedthat a random graph G ( n, m ) with n vertices and m edges undergoes an abruptchange when the average vertex degree is equal to one, that is when m ≈ n/ m = cn/ c <
1, asymptotically almost surely the connectedcomponents are all of size O (log n ), and are either trees or unicyclic graphs.Conversely, when c >
1, almost surely there is a unique giant component ofsize Θ ( n ). The density d = m/n = 1 / criticaldensity or phase transition density . See [3,11] for a discussion of these concepts.In this paper we investigate whether the density plays a similar role for theplanarity of small-medium sized graphs. Namely, when the the density of suchgraphs increases, does the probability of planarity change smoothly or abruptly?To answer this question one could think of using the result of (cid:32)Luczak etal. [13] who show that a random graph is almost surely non-planar if and only ifthe number of edges is n/ O ( n / ). From the point of view of the density thismeans that a graph is almost surely non-planar if the density is 1 / O ( n − / ).However, the result shows only an asymptotic bound and does not clarify whathappens for small-medium sized graphs. Essentially, this means that, for n → ∞ graphs with density greater than 1 / Θ ( n − / ). This result has been confirmed in [15], where it is proved thata graph with infinitely many vertices and density 1 / ≈ .
998 tobe planar. Again, this gives no hint about how large is in practice this transitionrange for small values of n . For example, Fig. 1 shows four plots for differentvalues of the constants c , . . . , c of the function ζ ( n, d ) which has both theasymptotic behaviors described in [13] (see Appendix A.1). ζ ( n, d ) = 12 ( d − (0 . c /n c )) · ( c + c n / ) + 1Depending on the values of c , . . . , c the function shows quite different be-haviours in the range n ∈ [1 , Tipping Point for the Planarity of Small and Medium Sized Graphs 3
In this paper we adopt a pragmatic point of view. Namely, we are interestedinto investigating what are the properties of a random graph of small-mediumsize n when its density increases. In particular, we experimentally measuredthat, for each graph size n ≤ All the experiments described in Section 3 are composed of three phases: gen-eration of graphs; measurement; and analysis. In this section we describe thecharacteristics of the three phases common to all experiments.
Generation of graphs.
In all experiments (but for near-planarity) we usedgraphs with a number n of vertices that varies from 1 to 400, increasing at eachstep by one. The density d = mn , where m is the number of edges, varies in a rangethat depends on the type of property that we are investigating. In fact, givena specific property, there always exists an interval of densities, that we call the significant interval , such that for a graph outside the significant interval eitherthe property is granted or the property is ruled out, while inside the significantinterval there are both graphs that have the property and graphs that do not.This is the interval of densities that we aim to experimentally explore .For each combination of size n and density d we determined the number ofedges m = Round( n · d ) of the graphs to be generated, and generated 10 , n vertices and m edges . In particular, we used function randomSimpleGraph of the OGDF library [6] for uniformly-at-random generat-ing labeled graphs with a given number of vertices and edges. All graphs weresimple (no loops or multiple edges allowed). Measurement.
For each combination of size and density we counted how manygraphs have the desired property.
Analysis.
We used Wolfram Mathematica 12.0.0.0 for producing the plots thatare in this paper. In particular, we used function
ListPlot3D that joins pointswith flat polygons. For the property of acyclicity it is also possible to computethe exact percentage of random graphs that are acyclic. This allowed us tocompare the measured frequency distribution with its probability counterpart(see Appendix A.2). We used Mathematica also for sampling contour lines ofsurfaces and for computing fitting functions of sets of value pairs. For the smallest graphs we may not have all densities. For example, there is no graphwith 5 vertices and density greater than 2. Function Round() rounds a value to the nearest integer, where Round(0 .
5) = 1 .
0. E. Balloni et al.(a)Number of vertices D e n s i t y (b)Number of vertices D e n s i t y Fig. 2. (a) Measured fraction of random graphs that are acyclic. (b) Measured fractionof random graphs that are planar.
In this section we report the results of the experiments to determine how densityand size impact graph-theoretic properties of random graphs of small-mediumsize. Since the purpose of the experiments is to show that planarity exhibitsa tipping point behavior when the density increases, we start our experimentswith acyclicity, a property that notoriously does not have tipping points [3, p.118]. Then, we consider planarity, outerplanarity, and near-planarity, the maintargets of our investigation.
Acyclicity in Random Graphs.
Simple graphs with less than three edges areacyclic. Conversely, since a tree has m = n − m = n a graphhas at least one cycle. Hence, the significant interval of densities for acyclicityis [ n , − n ]. We used densities ranging from 0 . .
0, with a step of 0 . × tests. The plot in Fig. 2(a) shows the measuredfrequency of acyclic graphs as a function of density and size. Is it apparent thatthe density is the main cause of the loss of acyclicity, while the size of the graphseems to have weaker effects. In particular, bigger graphs tend to loose acyclicityearlier than smaller graphs.Overall, the percentage of acyclic graphs seems to decrease smoothly throughthe significant interval of densities, without any quick transition or drop. Acyclicgraphs allow us to compare a case where the tipping point is absent with thecases discussed in the next sections where a tipping point is present. Also, foracyclicity we were able to compute the actual probability of a graph of havingthis property and we used the comparison between experimental and theoreticalvalues to validate the experimental pipeline (see Appendix A.2). Tipping Point for the Planarity of Small and Medium Sized Graphs 5(a) D e n s i t y N u m b e r o f v e rt i ce s (b)Number of vertices D e n s i t y Fitting curve: f
50% = 0 . . n . . n / Horizontal Asymptote at 0 . Fig. 3. (a) View from the side of the same graph of Fig. 2(b). (b) The samples atheight 50% (red dots) and a possible fitting curve (solid blue line).
Planarity in Random Graphs.
We now consider the property of the graph ofbeing planar. All graphs with less than 9 edges are planar and there is no planargraph with more than 3 n − n , n − n ]. For our experiments we used densities from 0 . .
0, witha step of 0 .
1, performing a total of 124 × planarity tests. In order to test thegenerated graphs for planarity we first used the OGDF function makeConnected that adds the minimum number of edges to make the graph connected and thencalled a single planarity test on the obtained graph: it can be easily seen thatthe minimality of the added edges implies that the connected graph is planar ifand only if the connected components of the original graph were all planar.Figs. 2(b) and 3(a) show a plot of the frequency of planar graphs in randomsimple graphs as a function of density and size. It is apparent that the percentageof planar graphs drops from 100% to 0% in a short range of density values. As anexample, for n = 200 we have that the fraction of planar graphs drops from 99%to 1% in the interval of densities [0 . , . .
6% ofthe significant interval. In contrast, for the same value of n , the fraction of acyclicgraphs depicted in Fig. 2(a) drops from 99% to 1% in the 53% of the significantinterval. The tipping point is strongly related with density and appears earlierin larger graphs. Figure 7(a) in the Appendix shows a plot of 9 equally spacedcontour lines at height 10% , , . . . , d = 1 / c /n c + c /n / . The result of the fitting is shown in Fig. 3(b).Observe that the value of c is consistent with the theory. E. Balloni et al.(a)Number of vertices D e n s i t y f
1% = 0 . . n . . n / f
99% = 0 . . n . − . n / Horizontal Asymptote at 0 . D e n s i t y f − f Fig. 4. (a) The sample points of the contour lines at height 1% and 99% and thecorresponding fitting curves. (b) Difference between the fitting curves in (a).
In order to evaluate the width of the transition range we determined thesample points of the contour lines at height 1% and 99% and computed twofittings, one for each set of such points. For both the fittings, again, we selecteda function of type d = 1 / c /n c + c /n / . The result are shown in Fig. 4(a).Observe how the difference between the two curves is very small (Fig. 4(b)).Surprisingly, for random graphs of small-medium size the drop value for themeasured fraction of planar graph is much smaller than it would have beenhoped for: if you grow the density of a random graph of small-medium size youvery likely loose planarity way before you have any chance to get connectivity( d = 1). Practically speaking, if you were interested into graphs with densityone, planarity is almost granted for number of vertices in the range [1 ,
40] but isalmost absent above 100 vertices. For density 1 .
5, instead, a random graph withmore than 25 vertices is very likely non-planar.
Outerplanarity in Random Graphs. An outerplanar graph is a graph thatadmits a planar drawing where all vertices are on the external face. All graphswith less than 6 edges are outerplanar — the smallest non-outerplanar graphsbeing K and K , — and there is no outerplanar graph with more than 2 n − n , n − n ].For our experiments we used densities from 0 . .
0, with a step of 0 . Near-Planarity in Random Graphs. A near-planar graph is a graph thatcan be made planar by removing (at most) one edge [5]. Near-planar graphs arealso called skewness- almost planar graphs [8]. The smallest not near-planargraph is K , , with 12 edges. From the definition of near-planar graphs it follows Tipping Point for the Planarity of Small and Medium Sized Graphs 7(a)Number of vertices D e n s i t y (b)Number of vertices D e n s i t y Fig. 5. (a) Measured fraction of random graphs that are outerplanar. (b) Measuredfraction of random graphs that are near-planar. that such graphs have a maximum of 3 n − n , n − n ]. In our experiments we useddensities ranging from 0 . . .
1. The recognition of near-planargraphs can be made in quadratic-time: it suffices to test for planarity any graphobtained by removing one edge.Figure 5(b) shows the measured fraction of random graphs that are near-planar as a function of the number of vertices (from 1 to 200) and the density.Observe that the transition from near-planar graphs to non-near-planar onesis sharper than what we measured for planarity or quasi-planarity, although itoccurs for higher values of densities.
We reported empirical evidence of the existence of a tipping point for planarityin random graphs of small-medium size. The same phenomenon appears to bepresent for restrictions and relaxations of planarity as outerplanarity and near-planarity. It would be interesting to measure whether other popular familiesof ‘beyond planar’ graphs, as 1-planar or quasiplanar graphs, also feature thesame abrupt transition in their distribution in random graphs. Unfortunately,testing 1-planarity is NP-complete [12] even for near-planar graphs [5] and, toour knowledge, no implementation of the FPT algorithm in [1] for testing 1-planarity is available. Also, no testing algorithm has been proposed for quasi-planarity. Finally, we could consider other types of graphs, as random bipartite,biconnected, or triconnected graph, as well as other graph models like small-world graphs or scale-free graphs.
E. Balloni et al.
Acknowledgments
We thank Carlo Batini for posing us the first question about rapid transitionsof graph properties. Sometimes questions are more important than answers. Wealso thank the anonymous reviewer for pointing out that the smallest not near-planar graph in terms of number of edges is K , . References
1. Bannister, M., Cabello, S., Eppstein, D.: Parameterized complexity of 1-planarity.J. Graph Algorithms Appl. (1), 23–49 (2018)2. Barrera-Cruz, F., Haxell, P., Lubiw, A.: Morphing schnyder drawings of planartriangulations. Discrete Comput. Geom. (1), 161–184 (2019)3. Bollob´as, B.: Random graph. Academic Press Inc., Harcourt Brace JovanovichPublishers, London (1985)4. Borrazzo, M., Da Lozzo, G., Di Battista, G., Frati, F., Patrignani, M.: Graphstories in small area. Journal of Graph Algorithms and Applications (3), 269–292 (2020). https://doi.org/10.7155/jgaa.005305. Cabello, S., Mohar, B.: Adding one edge to planar graphs makes crossing numberand 1-planarity hard. SIAM Journal on Computing (5), 1803–1829 (2013)6. Chimani, M., Gutwenger, C., J¨unger, M., Klau, G.W., Klein, K., Mutzel, P.: OpenGraph Drawing Framework (OGDF). In: Tamassia, R. (ed.) Handbook of GraphDrawing and Visualization, chap. 17. CRC Press (2014)7. Da Lozzo, G., Di Battista, G., Frati, F., Patrignani, M., Roselli, V.: Upward planarmorphs. Algorithmica (2020). https://doi.org/10.1007/s00453-020-00714-68. Didimo, W., Liotta, G., Montecchiani, F.: A survey on graph draw-ing beyond planarity. ACM Comput. Surv. (1), 4:1–4:37 (2019).https://doi.org/10.1145/33012819. Erd¨oos, P., R´eenyi, A.: On the evolution of random graphs. Magyar Tud. Akad.Mat. Kutat´oo Int. K¨ozl. , 17–61 (1960)10. de Fraysseix, H., Pach, J., Pollack, R.: How to draw a planar graph on a grid.Combinatorica (1), 41–51 (1990). https://doi.org/10.1007/BF0212269411. Janson, S., (cid:32)Luczak, T., Rucinski, A.: Random graphs. Wiley-Interscience Series inDiscrete Mathematics and Optimization, Wiley-Interscience, New York (2000)12. Korzhik, V.P., Mohar, B.: Minimal obstructions for 1-immersions and hard-ness of 1-planarity testing. Journal of Graph Theory (1), 30–71 (2013).https://doi.org/10.1002/jgt.2163013. (cid:32)Luczak, T., Pittel, B., Wierman, J.C.: The structure of a random graph at thepoint of the phase transition. Transactions of the American Mathematical Society (2), 721–748 (1994)14. Moon, J.W.: Counting Labeled Trees. Canadian Mathematical Monographs,William Clowes and Sons (1970)15. Noy, M., Ravelomanana, V., Ru´e, J.: The probability of planarity of a randomgraph near the critical point. In: International Conference on Formal Power Seriesand Algebraic Combinatorics (FPSAC 2013). pp. 791–802 (2013)16. Schnyder, W.: Embedding planar graphs on the grid. In: Johnson, D.S. (ed.) Pro-ceedings of the First Annual ACM-SIAM Symposium on Discrete Algorithms. pp.138–148. SIAM (1990)17. Tutte, W.T.: How to Draw a Graph. Proceedings of the London MathematicalSociety s3-13 (1), 743–767 (01 1963). https://doi.org/10.1112/plms/s3-13.1.743 Tipping Point for the Planarity of Small and Medium Sized Graphs 9 A Appendix
A.1 Asymptotic Study of Function ζ ( n, d ) Function ζ ( n, d ), mentioned in Section 1 is defined as follows: p = ζ ( n, d ) = 12 ( d − (0 . c /n c )) · ( c + c n / ) + 1 (1)In this section we show that: (i) the transition value for which ζ ( n, d ) = 0 . n → ∞ is equal to d = 0 . O ( n / ) and, hence,the transition range expressed with respect to density d = m/n is O ( n − / ). Forthe first statement, consider the function d = ψ ( n, p ) obtained by convertingEquation 1 to be explicit with respect to the density d : d = ψ ( n, p ) = log (1 /p − c + c n / + (0 . c /n c ) (2)It is immediate to observe that, provided that c , c >
0, the limit for n → ∞ of ψ ( n, . p = 0 . d = 0 . d -coordinate where ζ ( n, d )falls from p max = 0 . p min = 0 . p max > p min being equivalent). This is given by ψ ( n, p min ) − ψ ( n, p max ). In order to showthat this range falls as n − / , we divide this quantity by n − / and show thatthe limit for n → ∞ of the obtained function is a constant. In fact we have: ψ ( n, p max ) − ψ ( n, p min ) n − / = log (1 /p min − − log (1 /p max − c n − / + c (3)Since the numerator of Equation 3 is a constant and since lim n →∞ ( n − / ) =0, we have that the limit for n → ∞ of Equation 3 is also a constant. A.2 Comparison with Theoretical Values
For the case of acyclicity, we were able to compute the actual probability of arandom graph G ( n, m ) to be acyclic. In fact, since the number of possible edgesin a simple n -vertex graph is (cid:0) n (cid:1) , the number g n,m of labeled simple graphs with m edges is g n,m = (cid:0) ( n ) m (cid:1) . On the other hand, the number f n,k of labeled forestswith n vertices and k connected components is [14]: f n,k = (cid:18) nk (cid:19) k (cid:88) i =0 ( −
12 ) i ( k + i ) i ! (cid:18) ki (cid:19)(cid:18) n − ki (cid:19) n n − k − i − (4)where (cid:0) xy (cid:1) is assumed to be zero when y > x . Since each edge added to a forestdecreases the number of connected components by one, we have k = n − m (also,recall that in a forest m < n ). Therefore, from Equation (4) we can obtain the D e n s i t y (b) N u m b e r o f v e rt i ce s D e n s i t y Fig. 6. (a) Probability of random graphs to be acyclic. (b) The absolute value of thedifference between the measured frequency and the theoretical probability of the graphto be acyclic. number f n,m of labeled forests with m edges, plot the ratio f n,m g n,m , and comparethis function with the computed percentage. A plot of the probability f n,m g n,m of R ( n, m ) to be acyclic for n ∈ [1 , d = m/n ∈ [0 ,
1] is in Fig. 6(a).Figure 6(b), shows the absolute value of the difference between the computedfrequency and the actual probability. The average of such values is 0 . . − . Tipping Point for the Planarity of Small and Medium Sized Graphs 11(a)Number of vertices D e n s i t y Fig. 7.
A plot of 9 equally-spaced contour lines of the same graph of Fig. 2(b) at height10% , , . . . ,, . . . ,