Keywords

Years and Authors of Summarized Original Work

  • 1990; de Fraysseix, Pach, Pollack

  • 1990; Schnyder

Problem Definition

Every planar graph has a crossings-free drawing in the plane. Formally, a straight-line drawing of a planar graph G is one where each vertex is placed at a point in the plane and each edge is represented by a straight-line segment between the two corresponding points such that no two edges cross each other, except possibly at their common end points. A straight-line grid drawing of G is a straight-line drawing of G where each vertex of G is placed on an integer grid point. The area for such a drawing is defined by the minimum-area axis-aligned rectangle, or bounding box, that contains the drawing.

Wagner in 1936 [12], Fáry in 1948 [5], and Stein in 1951 [10] proved independently that every planar graph has a straight-line drawing. It was not until 1990 that the first algorithms for drawing a planar graph on a grid of polynomial area were developed. The concepts of canonical orders [4] and Schnyder realizers [9] were independently introduced for the purpose of efficiently computing straight-line grid drawings on the O(n) × O(n) grid. These two seemingly very different combinatorial structures turn out to be closely related and have since been used in many different problems and in many applications.

Key Results

We first describe canonical orders for planar graphs and a linear time procedure to construct them. Then we describe Schnyder realizers and a linear time procedure to compute them. Finally, we show how they can be used to compute straight-line grid drawings for planar graph.

Canonical Orders and Schnyder Realizers, Fig. 1
figure 39figure 39

(a) A canonical order of vertices for a maximal plane graph G, (b) insertion of v8 in G7, (c) a Schnyder realizer for G

Canonical Order

A planar graph G along with a planar embedding (a cyclic order of the neighbors for each vertex) is called a plane graph. Given a graph G, testing for planarity and computing a planar embedding can be done in linear time [6]. Let G be a maximal plane graph with outer vertices u, v, w in counterclockwise order. Then a canonical order or shelling order of G is a total order of the vertices \(v_{1} = u,v_{2} = v,v_{3},\ldots ,v_{n} = w\) that meets the following criteria for every 4 ≤ i ≤ n:

  1. (a)

    The subgraph \(G_{i-1} \subseteq G\) induced by v1, v2, , vi−1 is 2-connected, and the boundary of its outerface is a cycle Ci−1 containing the edge (v1, v2).

  2. (b)

    The vertex v i is in the outerface of Gi−1, and its neighbors in Gi−1 form a subinterval of the path \(C_{i-1} - (u,v)\) with at least two vertices; see Fig. 1a–1b.

Every maximal plane graph G admits a canonical order; see Fig. 1a–1b. Moreover, computing such an order can be done in O(n) time where n is the number of vertices in G. Before proving these claims, we need a simple lemma.

Lemma 1

Let G be a maximal plane graph with canonical order v1,v2= v,v3,…,vn. Then for i ∈{ 3,…,n − 1}, any separating pair {x,y} of Giis a chord of Ci.

The proof of the lemma is simple. Recall that a chord of a cycle \(\mathcal{C}\) is an edge between nonadjacent vertices of \(\mathcal{C}\). Since G is a maximal plane graph and since each vertex v j , j ∈ { n, , i + 1} is in the outerface of G j , all the internal faces of G i are triangles. Adding a dummy vertex d along with edges from d to each vertex on the outerface of G i yields a maximal plane graph G′. Then G′ is 3-connected, and for each separation pair {x, y} of G, the set T = { x, y, d} is a separating set of G′ since \(G = G^{\prime }\setminus d\). The set T is a separating triangle in G′ [1], and therefore, the edge (x, y) is a chord on C i .

Theorem 1

A canonical order of a maximal plane graph G can be computed in linear time.

This is also easy to prove. If the number of vertices n in G is 3, then the canonical ordering of G is trivially defined. Let n > 3 and choose the vertices \(v_{n} = w,v_{n-1},\ldots ,v_{3}\) in this order so that conditions (a)–(b) of the definition are satisfied. Since G is a maximal plane graph, G is 3-connected, and hence, \(G_{n-1} = G\setminus w\) is 2-connected. Furthermore, the set of vertices adjacent to v n  = w forms a cycle Cn−1, which is the boundary of the outerface of Gn−1. Thus, conditions (a)–(b) hold for k = n.

Assume by induction hypothesis that the vertices \(v_{n},v_{n-1},\ldots ,v_{i+1},i \geq 3\) have been appropriately chosen. We now find the next vertex v i . If we can find a vertex x on C i , which is not an end vertex of a chord, then we can choose v k  = x. Indeed, if deleting x from G i violated the 2-connectivity, then the cut vertex y of G i x, together with x, would form a separating pair for G i , and hence, (x, y) would be a chord in G i (from the lemma above). We now show that we can find a vertex v i on C i which is not an end vertex of a chord.

If there is no chord of C i , then we can choose any vertex of C i other than u and v as v k . Otherwise, label the vertices of C i −{ (u, v)} by \(p_{1} = u,p_{2},\ldots ,p_{t} = v\) consecutively from u to v. By definition, any chord (p k , p l ), k < l must have k < l − 1. We say that a chord (p k , p l ), k < l, includes another chord (pk, pl), k′ < l′, if k ≤ k′ < l′ ≤ l. Then take an inclusion-minimal chord (p k , p l ) and any vertex p j for k < j < l can be chosen as v i . Since v i is not an end vertex of a chord for \(C_{i-1},G_{i-1} = G_{i}\setminus v_{i}\) remains 2-connected. Furthermore, due to the maximal planarity of G, the neighborhood of v i on Ci−1 forms a subinterval for \(C_{i-1} - (u,v)\).

The algorithm, implicit in the above argument, can be implemented to run in linear time by keeping a variable for each vertex x on C i , counting the number of chords x is incident to. After each vertex v i is chosen, the variables for all its neighbors can be updated in O(deg(v i )) time. Summing over all vertices in the graph leads to an overall linear running time [2], and this concludes the proof of the theorem.

Schnyder Realizer

Let G be a maximal plane graph. A Schnyder realizer\(\mathcal{S}\) of G is a partition of the internal edges of G into three sets T1, T2, and T3 of directed edges, so that for each interior vertex v, the following conditions hold:

  1. (a)

    v has outdegree exactly one in each of T1, T2, and T3.

  2. (b)

    The clockwise order of edges incident to v is outgoing T1, incoming T2, outgoing T3, incoming T1, outgoing T2, and incoming T3; see Fig. 1c.

Since a maximal plane graph has exactly n − 3 internal vertices and exactly 3n − 9 internal edges, the three outgoing edges for each internal vertex imply that all the edges incident to the outer vertices are incoming. In fact, these two conditions imply that for each outer vertex r i , i = 1, 2, 3, the incident edges belong to the same set, say T i , where r1, r2, r3 are in counterclockwise order around the outerface and each set of edges T i forms a directed tree, spanning all the internal vertices and one external vertex r i , oriented towards r i  [3]; see Fig. 1c. Call r i the root of T i for i = 1, 2, 3.

Note that the existence of a decomposition of a maximal planar graph G into three trees was proved earlier by Nash-Williams [8] and by Tutte [11]. Kampen [7] showed that these three trees can be oriented towards any three specified root vertices r1, r2, r3 of G so that each vertex other than these roots has exactly one outgoing edges in each tree. Schnyder [9] proved the existence of the special decomposition defined above, along with a linear time algorithm to compute it. Before we describe the algorithm, we need to define the operation of edge contraction. Let G be a graph and e = (x, y) be an edge of G. Then we denote by Ge, the simple graph obtained by deleting x, y and all their incident edges from G, adding a new vertex z and inserting an edge (z, v) for each vertex v that is adjacent to either x or y in G. Note that for a maximal plane graph G, contracting an edge e = (x, y) yields a maximal plane graph if and only if there are exactly two common neighbors of x and y. Two end vertices of an edge e = (x, y) have exactly two common neighbors if and only if the edge e is not on the boundary of a separating triangle.

Lemma 2

Let G be a maximal plane graph with at least 4 vertices, where u is an outer vertex of G. Then there exists an internal vertex v of G such that (u,v) is an edge in G and vertices u and v have exactly two common neighbors.

This is easy to prove. If G has exactly 4 vertices, then it is K4 and the internal vertex of G has exactly two common neighbors. Consider graph G with more than 4 vertices. If u is not on the boundary of any separating triangle, then taking any neighbor of u as v is sufficient. Else, if u is on the boundary of a separating triangle Δ, we can find a desired vertex v by induction on the subgraph of G inside Δ.

Canonical Orders and Schnyder Realizers, Fig. 2
figure 310figure 310

Computing a Schnyder realizer of a maximal plane graph G from that of Ge

Theorem 2

A Schnyder realizer of a maximal plane graph G can be computed in linear time.

The proof of the theorem is by induction. If G has exactly 3 vertices, its Schnyder realizer is computed trivially. Consider graph G with more than 3 vertices. Let r1, r2, and r3 be the three outer vertices in counterclockwise order. Then by the above lemma, there is an internal vertex x in G and edge e = (r3, x) so that r3 and x have exactly two common neighbors. Let \(G^{\prime } = G/e\). Then by the induction hypothesis, G′ has a Schnyder realizer with the three trees T1, T2, and T3, rooted at r1, r2, and r3. We now modify this to find a Schnyder realizer for G. The orientation and partitioning of all the edges not incident to x remain unchanged from Ge. Among the edges incident to x, we add e to T3, oriented towards r3. We add the two edges that are just counterclockwise of e and just clockwise of e in the ordering around x, to T1 and T2, respectively, both oriented away from x. Finally we put all the remaining edges in T3, oriented towards x; see Fig. 2. It is now straightforward to check that these assignment of edges to the trees satisfy the two conditions. The algorithm implicit in the proof can be implemented in linear time, given the edge contraction sequence. The edge contraction sequence itself can be computed in linear time by taking the reverse order of a canonical order of the vertices and in every step contracting the edge between r3 and the current vertex in this order.

Drawing Planar Graphs

We now show how canonical orders and Schnyder realizers can be used to compute straight-line grid drawings of maximal plane graphs.

Theorem 3

Let G be a maximal plane graph with n vertices. A straight-line grid drawing of G on the \((2n - 4) \times (n - 2)\) grid can be computed in linear time.

This is a constructive proof. Let \(\mathcal{O} = v_{1},\ldots ,v_{n}\) be a canonical order of G, G i , the subgraph of G induced by the vertices v1, , v i , and C i the boundary of the outerface of G i , i = 3, 4, , n. We incrementally obtain straight-line drawing Γ i of G i for i = 3, 4, , n. We also maintain the following invariants for Γ i :

  1. (i)

    The x-coordinates of the vertices on the path \(C_{i}\setminus \{(v_{1},v_{2})\}\) are monotonically increasing as we go from v1 to v2.

  2. (ii)

    Each edge of the path C i −{ (v1, v2)} is drawn with slope 1 or − 1.

Canonical Orders and Schnyder Realizers, Fig. 3
figure 311figure 311

Illustration for the straight-line drawing algorithm using canonical order

We begin with G3, giving v1, v2, and v3 coordinates (0, 0), (2, 0), and (1, 1); the drawing Γ3 satisfies conditions (i)–(ii); see Fig. 3a. Suppose the drawing for Γi−1 for some i > 3 has already been computed; we now show how to obtain Γ i . We need to add vertex v i and its incident edges in G i to Γi−1. Let \(w_{1} = v_{1},\ldots ,w_{t} = v_{2}\) be the vertices on \(C_{i-1}\setminus \{(v_{1},v_{2})\}\) in this order from v1 to v2. By the property of canonical orders, v i is adjacent to a subinterval of this path. Let w l , , w r , 1 ≤ l < r ≤ t, be the vertices adjacent to v i , in this order. We want to place v i at the intersection point p between the straight line from w l with slope 1 and the straight line from w r with slope − 1. Note that by condition (ii), the two vertices w l and w r are at even Manhattan distance in Γ, and hence, point p is a grid point. However, if we place v i at p, then the edges v i w l and v i w r might overlap with the edges w l wl+1 and wr−1w r , since they are drawn with slopes 1 or − 1. We thus shift all the vertices to the left of w l in Γi−1 (including w l ) one unit to the left at all the vertices to the right of w r in Γi−1 (including w r ) one unit to the right; see Fig. 3.

Consider a rooted tree T, spanning all the internal vertex of G along with one external vertex v n , where v n is the root of T and for each internal vertex x, the parent of x is the highest numbered successor in G. (Later we see that T can be one of the three trees in a Schnyder realizer of G.) For any internal vertex x of G, denote by U(x) the set of vertices that are in the subtree of T rooted at v (including v itself). Then the shifting of the vertices above can be obtained by shifting the vertices in U(w i ), i = 1, , l one unit to the left and the vertices in U(w i ), i = r, , t one unit to the right. After these shifts, v i can be safely placed at the intersection of the line with slope 1 from w l and the line with slope − 1 from w r . Note that this drawing satisfies conditions (i)–(ii). This algorithm can be implemented in linear time, even though the efficient vertex shifting requires careful relative offset computation [2].

Canonical Orders and Schnyder Realizers, Fig. 4
figure 312figure 312

(a) A straight-line drawing for the graph in Fig. 1 using Schnyder realizer, (b)–(c) computation of a canonical order from a Schnyder realizer

The next theorem shows how Schnyder realizers can be used to compute a straight-line grid drawing of a plane graph. Let T1, T2, and T3 be the trees in a Schnyder realizer of G, rooted at outer vertices r1, r2, and r3. Since each internal vertex v of G has exactly one outgoing edge in each of the trees, there is a directed path P i (v) in each of the three trees T i from v to r i . These three paths P1(v), P2(v), and P3(v) are vertex disjoint except for v, and they define three regions R1(v), R2(v), and R3(v) for v. Here R i (v) is the region between the two paths Pi−1(v) and Pi+1(v), where the addition and subtraction are modulo 3. Let η i (v) denote the number of vertices in \(R_{i}(v)\setminus P_{i-1}(v)\), where i = 1, 2, 3 and the subtraction is modulo 3. Extend these definitions to the outer vertices as follows: \(\eta _{i}(r_{i}) = n - 2,\eta _{i+1}(r_{i}) = 1,\eta _{i-1}(r_{i}) = 0\).

Theorem 4

The coordinates ((η1(v),η2(v))) for each vertex v in G give a straight-line drawing Γ of G on a grid of size\((n - 2) \times (n - 2)\).

Place each vertex v at the point with coordinates (η1(v), η2(v), and η3(v)). Since \(\eta (v) =\eta _{1}(v) +\eta _{2}(v) +\eta _{3}(v)\) counts the number of vertices in all the three regions of v, each vertex of G except v is counted exactly once in η(v). Thus, \(\eta _{1}(v) +\eta _{2}(v) +\eta _{3}(v) = n - 1\) for each vertex v. Thus, the drawing Γ′ obtained by these coordinates (η1(v), η2(v), η3(v)) lies on the plane \(x + y + z = n - 1\). Furthermore, the drawing does not induce any edge crossings; see [9]. Thus, Γ′ is a straight-line drawing of G on the plane \(x + y + z = n - 1\). Then Γ is just a projection of Γ′ on the plane z = 0 and hence is planar. Since each coordinate in the drawing is bounded between 0 and n − 1, the area is at most \((n - 2) \times (n - 2)\); see Fig. 4a.

Equivalency of Canonical Orders and Schnyder Realizers

Here we show that canonical orders and Schnyder realizers are in fact equivalent in the sense that a canonical order of a graph defines a Schnyder realizer and vice versa [3].

Lemma 3

A canonical order for a maximal plane graph G defines a unique Schnyder realizer where the three parents for each vertex v of G are its leftmost predecessor, its rightmost predecessor, and its highest-labeled successor.

See Fig. 1a, 1c for a canonical order \(\mathcal{O}\) and the corresponding Schnyder realizer \(\mathcal{S}\) defined by \(\mathcal{O}\) for a maximal plane graph. One can easily verify that this definition of \(\mathcal{S}\) satisfies the two conditions for each internal vertex for a maximal plane graph. A canonical order \(\mathcal{O}\) and the Schnyder realizer \(\mathcal{S}\) obtained from \(\mathcal{O}\) for a maximal plane graph are said to be compatible.

We now describe two ways to obtain a canonical order from a Schnyder realizer \(\mathcal{S}\). In both cases, we obtain a canonical order which is compatible with \(\mathcal{S}\).

Lemma 4

Let G be a maximal plane graph with outer vertices r1,r2, and r3in counterclockwise order and let T1,T2, and T3be the three trees in a Schnyder realizer of G rooted at r1,r2, and r3. Then a compatible canonical order of G can be obtained as follows:

  1. 1.

    By taking the counterclockwise depth-first traversal order of the vertices in the graph\(T_{1} \cup \{ (r_{2},r_{1}),(r_{3},r_{1})\}\); see Fig. 4b.

  2. 2.

    By taking the topological order of the directed acyclic graph\(T_{1}^{-1} \cup T_{2}^{-1} \cup T_{3}\), where\(T_{i}^{-1},i = 1,2\)is the Schnyder tree Tiwith reversed edge directions; see Fig. 4c.

It is not difficult to show that the directed graph \(T_{1}^{-1} \cup T_{2}^{-1} \cup T_{3}\) is in fact acyclic [3, 9]. Then it is easy to verify that the canonical orders obtained from a Schnyder realizer \(\mathcal{S}\) are compatible with \(\mathcal{S}\); i.e., defining a Schnyder realizer from them by Lemma 3 produces the original Schnyder realizer \(\mathcal{S}\).

Cross-References