GRAPH ALGORITHMS Week 13 (9 Ian - 14 Ian 2017) C. Croitoru [email protected] FII January 7, 2017 1 / 25 2 / 25 LA MULŢI ANI! 3 / 25 OUTLINE Planar Graphs I Basic Properties I Planar Graphs Drawing I Plane Graphs – Combinatorial version I Planar Graphs – Small Separators 4 / 25 Planar Graphs – Basic Properties Definition of a Planar Graph Let G = (V , E ) be a graph and S be a surface (e.g., plane, sphere) in R3 . An embedding of G on S is a graph G 0 = (V 0 , E 0 ) such that: a) G ∼ = G 0; b) V 0 is a set of (distinct) points of S; c) Every edge e 0 ∈ E 0 is simple curve (Jordan arc) contained in S, joining its extremities; d) Every point of S is either a vertex of G 0 or it is contained in at most one edge of G 0 . S is a plane ⇒ G is a planar graph and G 0 is a plane representation of G . If S is a plane and G 0 is a graph satisfying the above b), c) and d) constraints, then G 0 is a plane graph. 5 / 25 Planar Graphs – Basic Properties Stereographic Projection Lemma A graph is planar if and only if it has an embedding on a sphere. Proof. If G is planar, let G 0 be a planar representation of G on the plane π. Take x a point in π and consider a sphere S tangent to π in x. Let y the diametral point of x in S. Consider φ : π → S given by φ(M)= the point different from y in which the line My intersects the sphere, ∀M ∈ π. φ is a bijection and therefore φ(G 0 ) is an embedding of G on S. y S G’ x pi Conversely, if G has an embedding on a sphere S: take y a point in S, consider x, the diametral point of y on S, construct a tangent plane π to S in x, and define ψ : S → π by ψ(M)= the point in which the line yM intersects the plane π, for all M ∈ S. The ψ-image of the embedding of G on the sphere is the required planar representation of G . 6 / 25 Planar Graphs – Basic Properties Faces Let G be a plane graph. If we delete the points of G (its vertices and edges) from the plane, this is decomposed into a finite union of maximal connected regions ( any two points can be joined by a simple curve contained in the region) of the plane, which are called the faces of G . Exactly one of these faces is unbounded and it is called the exterior (outer) face. Each face is characterised by the set of edges forming its boundary. Every circuit of G divides the plane in exactly two connected regions, hence every edge of a circuit belongs to exactly two boundaries (of two faces). 7 / 25 Planar Graphs – Basic Properties Faces A planar graph may have different planar representations. Example: 5 6 2 6 f4 5 f4 f1 f3 f5 7 8 3 2 f5 4 2 f4 1 f2 8 4 1 6 1 f3 f1 f1 3 f2 7 8 5 4 f5 f3 7 3 f2 Lemma Any planar representation of a planar graph can be transformed into a (different) planar representation in which a specified face of the first one becomes the exterior face of the second. Proof. Let G 0 be a planar representation of G and F a face of G 0 . Let G 0 be an embedding of G 0 on a sphere and F 0 be the face of G 0 corresponding to F . Choose a point y into the interior of F 0 , x its diametral point on the sphere, and π the plane tangent in x to the sphere. G 00 = ψ(G 0 ) is a representation of G in the plane π having as its exterior face ψ(F 0 ). 8 / 25 Planar Graphs – Basic Properties Euler’s Formula Theorem. Let G = (V , E ) be a connected plane graph with n vertices, m edges and f faces. Then, f = m − n + 2. Proof. Induction on f . If f = 1, then G has no circuit and, since it is connected, it is a tree. It follows m = n − 1 and the theorem holds. In the inductive step, suppose that the theorem holds for any connected plane graph with less than f (≥ 2) faces. Let e be an edge belonging to a circuit of G (there is such circuit, since f ≥ 2). Then e belongs to the boundary of exactly 2 faces of G . It follows that G1 = G − e is a connected plane graph having n vertices, m − 1 edges and f − 1 faces. The theorem holds for G1 , therefore f − 1 = m − 1 − n + 2, that is, f = m − n + 2. Remark. From an algorithmic point of view, the above theorem implies (see the next two corollaries) that any planar graph is sparse: if m is its number of edges and n is number of vertices, then m = O(n). 9 / 25 Planar Graphs – Basic Properties Euler’s Formula – Corollaries Corollary 1. Let G = (V , E ) be a connected planar graph with n(≥ 3) vertices and m > 2 edges. Then, m ≤ 3n − 6. Proof. Let G 0 be a planar representation of G . If G 0 has only one face, then G is a tree, m = n − 1, and for n ≥ 3 the inequality stated holds. If G 0 has at least 2 faces, then each face F of G 0 has in its boundary the edges of a circuit C (F ), and each such edge belongs to exactly 2 faces. Any circuit of G 0 has at least 3 edges, hence X X length(C (F )) ≥ 3 = 3f = 3(m − n + 2), 2m ≥ F face of G’ F face of G’ which gives the stated inequality. Remark. The graph K5 is not planar (its number of vertices is 5, its number of edges is 10 and 10 > 3 · 5 − 6). 10 / 25 Planar Graphs – Basic Properties Euler’s Formula – Corollaries Corollary 2. Let G = (V , E ) be a connected bipartite planar graph with n vertices and m > 2 edges. Then, m ≤ 2n − 4. Proof. Same proof as of Corollary 1, but using the fact that any circuit of G 0 has at least 4 edges. Remark. The graph K3,3 is not planar (its number of vertices is 6, its number of edges is 9 and 9 > 2 · 6 − 4). Corollary 3. If G = (V , E ) is a connected planar graph, then there is v0 ∈ V such that dG (v0 ) ≤ 5 Proof. We can suppose that G has at least 2 edges (to avoid trivial cases). Let G 0 a planar representation of G with n vertices and m edges. If we denote by ni Pn−1 the number of vertices of degree i ((1 ≤ i ≤ n − 1)) then i=1 i· ni = 2m P P ≤ 2(3n− 6) = 6( i ni ) − 12. Hence, i (i − 6)ni + 12 ≤ 0. For i ≥ 6 all terms in this sum are ≥ 0, thus there is i0 ≤ 5 such that ni0 > 0. 11 / 25 Planar Graphs – Basic Properties Kuratowski’s Theorem Let G = (V , E ) be a graph and v ∈ V (G ) such that dG (v ) = 2 and vw1 , vw2 ∈ E , w1 6= w2 . Let h(G ) = (V \ {v }, E \ {vw1 , vw2 } ∪ {w1 w2 }). Then, G is planar if and only if h(G ) is planar. (Suppose h(G ) planar. Then, if w1 w2 6∈ E (G ) then on the simple curve joining the points corresponding to w1 and w2 in a planar representation of h(G ) a new point is inserted corresponding to v ; if w1 w2 ∈ E (G ) we consider a new point corresponding to v close ”enough” to the curve representing w1 w2 in one of the faces of the planar representation of h(G ) and ”join” this new point to the points corresponding to w1 and w2 by simple curves non-intersecting those already existing. Conversely, if G is planar, in its planar representation, delete the point corresponding to v and the two curves corresponding to vw1 and vw2 are replaced by their union; if w1 w2 ∈ E (G ), the simple curve corresponding to it is deleted.) We denote by h∗ (G ) the graph obtained from G by applying repeatedly the h transformation until a graph without vertices of degree 2 is obtained. It follows that G is planar if and only if h∗ (G ) is planar. Two graphs G1 and G2 are homeomorphic if h∗ (G1 ) ∼ = h∗ (G2 ). Theorem (Kuratowski 1930)A graph is planar if and only if it has no subgraphs homeomorphic to K5 sau K33 . 12 / 25 Planar Graphs Drawing Fraysseix, Pach, Pollack (1988) Fary 1948 ( independent Wagner and Stein): Every planar graph has a planar representation with all edges straight line segments (Fary’s representation). Challenge: Finding a Fary’s representation with the points representing the vertices having integer coordinates and the area of the surface occupied by the representation polynomial in n, the number of vertices. Theorem (Fraysseix, Pach, Pollack (1988))Every planar graph G with n vertices has a planar representation with vertices in points with integer coordinates in [0, 2n − 4] × [0, n − 2] and with all edges straight line segments. Algorithmic proof: we will outline an O(n log n) drawing. W.l.o.g., we will assume that G is maximal planar: ∀e ∈ E (G ), G + e is not planar (we add edges to G in order to make it maximal planar and when these additional edges (segments) are drawn they are invisible). Note that any face of a maximal planar graph is a triangle and has 3n − 6 edges, where n is its number of vertices. 13 / 25 Planar Graphs Drawing Fraysseix, Pach, Pollack (1988) Lemma 1. Let G be a planar graph and G 0 a planar representation of G . If C 0 is a circuit of G 0 passing through the edge uv ∈ E (G 0 ), then there is w ∈ V (C 0 ) such that w 6= u, v and there is no interior chord of C 0 with one extremity in w . Proof. Let v1 , v2 , ..., vn be the vertices of C 0 in a traversal of it from u to v (v1 = u, vn = v ). If C 0 has no interior chords, then lemma trivially holds. Otherwise, choose the pair (i, j) such that vi vj is an interior chord of C 0 and j − i = min{k − l | k > l + 1, vk vl ∈ E (G 0 ), vk vl interior chord of C 0 }. Then, w := vi+1 is not incident with an interior chord (vi+1 vp with i + 1 < p < j is not an interior chord – by the choosing of the pair (ij), and vi+1 vl with l < i or l > j is not an interior chord since they must cross vi vj ). vi+1 v i vj v =u 1 v =v n 14 / 25 Planar Graphs Drawing Fraysseix, Pach, Pollack (1988) Lemma 2. Let G be a maximal planar graph with n ≥ 4 vertices and G 0 a planar representation of G having as exterior face the triangle u, v , w . Then, there is a labeling v1 , v2 , ..., vn of the vertices of G 0 such that v1 = u, v2 = v , vn = w and, for every k ∈ {4, . . . , n}, we have: 0 i) The induced subgraph Gk−1 = [{v1 , . . . , vk−1 }]G 0 is 2-connected and its 0 exterior face is determined by the circuit Ck−1 containing uv . 0 ii) In the induced subgraph Gk0 , the vertex vk is in the exterior face of Gk−1 and 0 NGk0 (vk ) ∩ {v1 , . . . , vk−1 } is a path of length ≥ 1 on the circuit Ck−1 − uv . vn =w vk Ck - 1 v =u 1 v =v 2 15 / 25 Planar Graphs Drawing Fraysseix, Pach, Pollack (1988) 0 Proof of Lemma 2. Let v1 = u, v2 = v , vn = w , Gn0 = G , Gn−1 = G − vn . Observe that NGn0 (vn ) is a circuit containing uv (after a simple sorting of NG 0 (w ) after x-coordinate, and using the maximal planarity). It follows that i) and ii) hold for k = n. 0 If vk has been chosen (k ≤ n), then in Gk−1 = G 0 − {vn , . . . , vk }, the 0 neighbors of vk determine a circuit Ck−1 containing uv and forming the 0 boundary of the exterior face of Gk−1 . 0 By Lemma 1, there is vk−1 on Ck−1 such that vk−1 is not the extremity of 0 an interior chord of Ck−1 . 0 From the construction, vk−1 is not incident with external chords of Ck−1 0 0 (by the maximal planarity). It follows that Gk−2 will contain a circuit Ck−2 with properties (i) şi (ii). 16 / 25 Planar Graphs Drawing Fraysseix, Pach, Pollack (1988) Proof of the Theorem. Let G maximal planar with n vertices and G 0 be a planar representation with vertices labeled v1 , . . . , vn as in Lemma 2, and u, v , w its exterior face. We will construct a Fary representation of G having as vertices points of integer coordinates. In the step k(≥ 3) of construction, we have such a representation of Gk and the following three conditions are fulfilled: 1 v1 has coordinates xv1 = 0 and yv1 = 0; v2 has coordinates xv2 = i ≤ 2k − 4, yv2 = 0. 2 If w1 , w2 , . . . , wm are the vertices of the circuit giving the exterior face of Gk , in a traversal from v1 to v2 (w1 = v1 , wm = v2 ), then xw1 < xw2 < . . . < xwm . 3 The edges w1 w2 , w2 w3 , . . . , wm−1 wm are straight line segments parallel with one of the two bisectors of the coordinate axis. 17 / 25 Planar Graphs Drawing Fraysseix, Pach, Pollack (1988) Condition (3) implies that ∀i < j, the parallel through wi to the first bisector intersects the parallel through wj to the second bisector in a point with integer coordinates (wi and wj have integer coordinates). 0 Construction of Gk+1 . Let wp , wp+1 , . . . , wq be the neighbors from Gk0 of vk+1 in P 0 Gk+1 (1 ≤ p < q ≤ m). w wp w 3 wq-1 p+1 w p+2 wq-2 wq w 2 w = v1 =u 1 w = v2 =v m The parallel through wp to the first bisector intersects the parallel through wq to the second bisector in point P. If from P we can draw the segments Pwi , p ≤ i ≤ q such that all are distinct, then we can take vk+1 := P to obtain the Fary representation of Gk+1 with all vertices having integer coordinates, satisfying the conditions 1-3. 18 / 25 Planar Graphs Drawing Fraysseix, Pach, Pollack (1988) If the segment wp wp+1 is parallel with the first bisector, then we translate with 1 to the right all vertices of Gk having the x-coordinate ≥ xwp+1 . Make another translation with 1 of all vertices of Gk having the x-coordinate ≥ xwq . Now, all segments P 0 wi , for p ≤ i ≤ q, are distinct, the segments wi wi+1 with i = q, m − 1 have slopes ±1 and also wp P 0 şi P 0 wq have slopes ±1 (where P 0 is the intersection of the parallel to the first bisector through wp with the parallel to the second bisector through wq ). Take vk+1 := P 0 and the step k of the construction is finished. Note that the algorithm can be implemented in O(n log n) time. 19 / 25 Plane Graphs — Combinatorial version Cellular Topological Model (Combinatorial Maps) In the combinatorial version, a graph is a triple G = (E , θ,− ), where E is an even cardinality set, − is an involution on E (permutation of order 2) without fixed points, and θ is a permutation on E . Intuitively: the elements of E are arcs (darts); the pair (e, e) is an edge; the involution − changes the direction (of the arc); the permutation θ gives the order of the edges when turning counterclockwise around a vertex: vertices are the cycles of the permutation θ (a minimal non-empty set of E closed w.r.t. θ). If V is the set of vertices, then we define t : E → V , t(e) = the unique cycle of θ containing e (tail of e) h : E → V , h(e) = the unique cycle of θ containing e (head of e) Note that ∀e t(e) = h(e) and h(e) = t(e). A face of G is a cycle of the permutation θ∗ : E → E given by θ∗ (e) = θ(e), ∀e ∈ E . The number of faces of G is denoted by f . O connected component of G is an orbit of E in the group generated by θ and − . 20 / 25 Plane Graphs — Combinatorial version Cellular Topological Model (Combinatorial Maps) 6 5 9 7 10 4 8 3 1 2 11 12 Corresponding Combinatorial Map A plane graph Let G be a (combinatorial) graph with m = 12 |E | edges, n = |V | vertices, f faces, and c connected components. The Euler characteristics of G is χ(G ) = 2c + m − n − f . A graph G is a plane graph if χ(G ) = 0. If a graph (in the usual definition) is connected, then the two notions of plane graphs are the same. 21 / 25 Planar Graphs – Small Separators Separator’s Theorem Theorem (Tarjan & Lipton, 1979). Let G be a planar graph with n vertices. There is a partition (A, B, S) of V (G ) such that: 1 2 3 S separates A from B in G : G − S has no edges from A to B, |A| ≤ 23 n, |B| ≤ 32 n , √ |S| ≤ 4 n. This partition can be found in O(n) time. Proof Idea. Take G a connected plane graph. Execute a bfs traversal from some vertex s, labeling each vertex v by its level in the bfs tree obtained. Let L(t), the set of all vertices on the levl t, for 0 ≤ t ≤ l + 1. The last level L(l + 1) is empty – from technical reasons (the last level is in fact l). Each internal level is a separator in G (we have edges only between consecutive levels). Let t1 the middle n level, that is, the level in which there in the Sis the b 2c vertex encountered S traversal. The set L(t1 ) satisfies : t<t1 L(t) < n2 ∧ t>t1 L(t) < n2 . √ If |L(t1 )| ≤ 4 n, the theorem holds. 22 / 25 Planar Graphs – Small Separators Separator’s Theorem Lemma.There are levels t0 ≤ √ t1 and t2 > t1 such that |L(t0 )| ≤ √ |L(t2 )| ≤ n and t2 − t0 ≤ n. √ n, √ Take t0 the maximum integer satisfying t0 ≤ t1 and |L(t0 )| ≤ n (there is such a level √ since |L(0)| = 1). There is t2 the minimum integer satisfying t2 > t1 and |L(t2 )| ≤ n √ (note that |L(l + 1)| = 0). Any level between t0 and t2 has more than n vertices, √ therefore the number of these levels is less than n (otherwise, the number of vertices is > n). Let C = ∪t<t0 L(t), D = ∪t0 <t<t2 L(t), E = ∪t>t2 L(t). t1 t t0 2 s C D E 23 / 25 Planar Graphs – Small Separators Separator’s Theorem |D| ≤ 32 n. The theorem holds with S = L(t0 ) ∪ L(t2 ), A the set with maximum number of elements between C , D, E and B the union of the remaining two sets (C şi E have at most n2 elements). 2 2 2 n1 = |D| √ > 3 n. If we could find a separator of type 3 ↔ 3 for D with at most 2 n vertices, then we add it√to L(t0 ) ∪ L(t2 ) in order to obtain a separator of cardinality at most 4 n, take as A the union of the set of maximum cardinality between C and E with the small part remained in D, and take as B the union of other 2 remaining sets. The separator for (the graph induced by) D can be constructed as follows: delete all the vertices of G which are not from D, excepting s which is joined with all vertices of the level t0 + 1. The graph obtained is denoted √ by D and is planar and connected. It has a spanning tree of√diameter at most 2 n (any vertex is reached from s by a path of length at most n, as we prooved in the Lemma. This tree is traversed dfs in order to obtain the desired separator. Details (very nice) are omitted. 24 / 25 Planar Graphs – Small Separators An Application of Separator’s Theorem Let us consider the problem of deciding if a given planar graph has a (vertex) 3-coloring, which is an NP-complete problem. For a graph G with a small number of vertices (for a constant number c, we can verify all O(3c ) = O(1) functions from V (G ) to {1, 2, 3}) if it has a a 3-coloring. For planar graphs with the number n of vertices > c, we construct in linear time, √ O(n), the partition (A, B, C ) of its vertex set, with |A|, |B| ≤ 2n 3 and |C | ≤ 4 n. √ For each of 3|C | = 2O( n) possible functions from C to {1, 2, 3} it is tested if it is a 3-coloring of the subgraph induced by C and if it can be extended to a 3-coloring of the subgraph induced by A ∪ C in G and also to a 3-coloring of the subgraph induced by B ∪ C in G (recursively). The running time T (n), of this algorithm, satisfies the recursion T (n) = ( O(1) √ √ O(n) + 2O( n) (O( n) + 2T ( 2n )) 3 dacă n ≤ c; dacă n > c. √ It follows T (n) = 2O( n) (it is possible that the constants behind the notation O(.) to be very large). 25 / 25
© Copyright 2026 Paperzz