Professional Documents
Culture Documents
3,1999
3,1999
http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 1, pp. 1–18 (1999)
Takao Nishizeki
Graduate School of Information Sciences
Tohoku University
Aoba-yama 05, Sendai 980-8579, Japan
nishi@ecei.tohoku.ac.jp
In an ordinary edge-coloring of a graph each color appears at each vertex
at most once. An f -coloring is a generalized edge-coloring in which each color
appears at each vertex v at most f (v) times where f (v) is a positive integer
assigned to v. This paper gives efficient sequential and parallel algorithms to
find ordinary edge-colorings and f -colorings for various classes of graphs such as
bipartite graphs, planar graphs, and graphs having fixed degeneracy, tree-width,
genus, arboricity, unicyclic index or thickness.
1 Introduction
This paper deals with a simple graph G which has no multiple edges or self-
loops. An edge-coloring of a graph G is to color all the edges of G so that no two
adjacent edges are colored with the same color. The minimum number of colors
needed for an edge-coloring is called the chromatic index of G and denoted by
χ0 (G). In this paper the maximum degree of a graph G is denoted by ∆(G) or
simply by ∆. Vizing showed that χ0 (G) = ∆ or ∆ + 1 for any simple graph G
[10, 30]. The edge-coloring problem is to find an edge-coloring of G with χ0 (G)
colors. Let f be a function which assigns a positive integer f (v) to each vertex
v ∈ V . Then an f -coloring of G is to color all the edges of G so that, for
each vertex v ∈ V , at most f (v) edges incident to v are colored with the same
color. Thus an f -coloring of G is a decomposition of G to edge-disjoint spanning
subgraphs in each of which vertex degrees are bounded above by f . An ordinary
edge-coloring is a special case of an f -coloring for which f (v) = 1 for every vertex
v ∈ V . The minimum number of colors needed for an f -coloring is called the
f -chromatic index of G and denoted by χ0f (G). The f -coloring problem is to
find an f -coloring of G with χ0f (G) colors. Let ∆f (G) = maxv∈V dd(v)/f (v)e
where d(v) is the degree of vertex v, then χ0f (G) = ∆f or ∆f + 1 for any simple
graph G [13].
The edge-coloring and f -coloring have applications to scheduling problems
like the file transfer problem in a computer network [5, 24, 25]. In the model a
vertex of a graph G represents a computer, and an edge does a file which one
wishes to transfer between the two computers corresponding to its ends. The
integer f (v) is the number of communication ports available at a computer v.
The edges colored with the same color represent files that can be transferred
in the network simultaneously. Thus an f -coloring of G with χ0f (G) colors
corresponds to a scheduling of file transfers with the minimum finishing time.
Since the ordinary edge-coloring problem is NP-complete [15], the f -coloring
problem is also NP-complete in general. Therefore it is very unlikely that there
exists an exact algorithm which solves the ordinary edge-coloring problem or
the f -coloring problem in polynomial time. However, the following approxi-
mate algorithms are known. Any simple graph G can be edge-colored with
∆ + 1 colors in polynomial
√ time [27, 29]; the best known algorithm takes time
O(min{n∆ log n, m n log n}) [12], where we denote by n the number of the
vertices and m the number of the edges in G. Furthermore, the proof in [13]
immediately yields an approximate algorithm to f -color any simple graph with
∆f + 1 colors in time O(mn). On the other hand, exact algorithms to edge-color
G with χ0 (G) colors are known for restricted classes of graphs as follows:
(a) an O(m log n)-time algorithm for bipartite graphs [6, 11];
(b) a linear-time algorithm for planar graphs of ∆ ≥ 19 [4];
(c) an O(n log n)-time algorithm for planar graphs of ∆ ≥ 9 [3];
(d) an O(n2 )-time algorithm for planar graphs of ∆ ≥ 8 [12, 27];
(e) a linear-time algorithm for series-parallel multigraphs [34]; and
(f) a linear-time algorithm for partial k-trees [32].
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 3
2 Preliminary
In this section we define terminology and observe relationships between various
graph invariants.
A graph with vertex set V and edge set E is denoted by G = (V, E). The
vertex set and the edge set of a graph G is often denoted by V (G) and E(G),
respectively. We denote the number of vertices in G by n(G) or simply n, and
denote the number of edges in G by m(G) or simply m. We say that a graph
G is trivial if m(G) = 0. The degree of v in G is denoted by d(v, G) or simply
by d(v). We denote by ∆(G) the maximum degree of vertices of G and by δ(G)
the minimum degree. The graph obtained from G by deleting all vertices in
V 0 ⊆ V (G) is denoted by G − V 0 . The graph obtained from G by deleting all
edges in E 0 ⊆ E(G) is denoted by G − E 0 .
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 4
s(G) ≤ 5. (1)
a(G) ≤ 3, (4)
since every unicyclic graph is planar and every planar graph can be decomposed
into at most three edge-disjoint forests [8].
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 5
The genus g(G) of a graph G is the minimum number of handles which must
be added to a sphere so that G can be embedded on the resulting surface. Of
course, g(G) = 0 if and only if G is planar. It is known [14, 17] that if g(G) ≥ 1
then j p k
δ(G) ≤ 5 + 48g(G) + 1 /2 . (7)
One can observe that the following upper bound holds on the minimum
degree.
Proof: (a) One may assume that G has no isolated vertices. Let n0 be the
number of vertices v of G such that 1 ≤ d(v) ≤ 2a(G) − 1. Then clearly
n0 + 2a(G)(n − n0 ) ≤ 2m. On the other hand, G can be decomposed into
a(G) edge-disjoint forests, and any forest has at most n − 1 edges. Therefore
m ≤ a(G)(n−1). Thus n0 ≥ 2a(G)/(2a(G)−1) > 1, and hence δ(G) ≤ 2a(G)−1.
(b) and (c) Since every vertex in V − U has degree ≥ 2a0 (G) + 1, we have
0
(2a (G) + 1)(n − |U |) ≤ 2m. Since any unicyclic graph has at most n edges,
we have m ≤ a0 (G)n. Thus we have |U | ≥ n/(2a0 (G) + 1). Hence U 6= φ and
δ(G) ≤ 2a0 (G). If a0 (G) is bounded, then |U | = Θ(n). 2
By Lemma 1 and Eqs. (1), (2), (4)–(6) and (8) we can immediately derive
the following upper bounds on s(G) in terms of k(G), a(G), a0 (G), θ(G) and
g(G). Note that a(H) ≤ a(G), a0 (H) ≤ a0 (G), θ(H) ≤ θ(G) and g(H) ≤ g(G)
for any subgraph H of G.
p
k(G) O g(G)
2a(G) − 1 2a0 (G)
hhhh
hhhQ
s(G)
3θ(G)
hhhh
hh
a(G)
a0 (G)
θ(G)
3 Chromatic Index
By the classical Vizing’s theorem, χ0 (G) = ∆ or ∆ + 1 for any simple graph G
[10, 30]. Vizing also showed that χ0 (G) = ∆ if ∆ ≥ 2s(G). In this section we
give various lower bounds on ∆(G) for χ0 (G) = ∆(G) to hold true, expressed in
terms of various invariants such as k(G), a(G), a0 (G), θ(G) and g(G).
For vertices u and v, we denote by d∗u (v) the number of v’s neighbors, other
than u, having degree ∆(G). An edge (u, v) ∈ E is eliminable if either d(u) +
d∗u (v) ≤ ∆(G) or d(v) + d∗v (u) ≤ ∆(G) [27, 29]. The following lemma is an
expression of a classical result on “critical graphs,” called “Vizing’s adjacency
lemma” (see, for example, [10, 27, 29]). In other words, the edges that are
excluded in a critical graph by the adacency lemma are eliminable. Note that
the definition is not symmetric with u and v.
Lemma 3 If (u, v) is an eliminable edge of a simple graph G and χ0 (G −
(u, v)) ≤ ∆(G), then χ0 (G) = ∆(G).
Thus, if we remove an eliminable edge (u, v) and can color the remaining
graph G − (u, v) with ∆(G) colors, then the obtained coloring can be extended
to the edge (u, v) without using more colors.
Vizing [31] obtained the following two theorems. We give proofs for them,
which yield an O(mn) algorithm to edge-color G with ∆ colors if ∆(G) ≥ 2s(G),
as we will show in the succeeding section.
Theorem 1 [31] Any nontrivial graph G has an eliminable edge if ∆(G) ≥
2s(G).
Proof: Let U = {u ∈ V (G) | d(u, G) ≤ s(G)}. Then U 6= φ because the
definition of the degeneracy implies that G has at least one vertex of degree
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 7
≤ s(G). Furthermore V −U 6= φ since ∆ ≥ 2s(G) > s(G) and hence the vertices
of degree ∆ are not contained in U . Thus H = G − U is not empty and s(H) ≤
s(G). Therefore H has a vertex v of degree ≤ s(G). Since s(G) + 1 ≤ d(v, G)
and d(v, H) ≤ s(G), G has an edge (u, v) joining v and a vertex u ∈ U . Since
u ∈ U , d(u) ≤ s(G) < 2s(G) ≤ ∆. Thus none of v’s neighbors in U has degree
∆, and hence d∗u (v) ≤ d(v, H) ≤ s(G). Therefore d(u) + d∗u (v) ≤ 2s(G) ≤ ∆,
and hence edge (u, v) is eliminable. 2
A result better than Corollary 1(g) is known [10, 27]: χ0 (G) = ∆(G) if G is
planar and ∆(G) ≥ 8.
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 8
4 Finding Edge-Colorings
The proofs of Theorems 1 and 2 yield an exact algorithm to edge-color a graph G
with ∆ colors if ∆(G) ≥ 2s(G). However, the algorithm takes O(mn) time, since
it repeats operations of “shifting a fan sequence” and “switching an alternating
path” O(m) times and each operation takes O(n) time [27]. In this section we
give a more efficient exact algorithm of complexity O(n log n) for the case where
a0 (G) is bounded and ∆(G) is large: ∆(G) ≥ 4a0 (G). Remember that a0 (G) ≤
s(G). Furthermore we give an NC parallel exact algorithm for this case. Our
algorithms first decompose a given graph G of large maximum degree to several
edge-disjoint subgraphs of small maximum degrees by using Zhou, Nakano and
Nishizeki’s algorithm [32], and then find edge-colorings of the subgraphs by
using Chrobak and Nishizeki’s algorithm (for planar graphs) [3], and finally
superimpose the edge-colorings of subgraphs to obtain an edge-coloring of G.
The main result of this section is the following.
Theorem 3 If the unicyclic index a0 (G) is bounded and ∆(G) ≥ 4a0 (G), then
graph G can be edge-colored by ∆(G) colors in O(n log n) sequential time or in
O(log3 n) parallel time with O(n log3 n) operations.
By Lemma 2 and Eqs.(2)–(6) we have the following corollary.
Corollary 2 Graph G can be edge-colored by ∆(G) colors in O(n log n) sequen-
tial time or in O(log3 n) parallel time with O(n log3 n) operations if one of the
following (a) – (g) holds:
(a) G belongs to a minor closed class G and ∆(G) ≥ 4h(G);
(b) a(G) is bounded and ∆(G) ≥ 4a(G);
(c) s(G) is bounded and ∆(G) ≥ 4s(G);
(d) k(G) is bounded and ∆(G) ≥ 4k(G);
(e) θ(G) is bounded and ∆(G) ≥ 12θ(G);
j p k
(f) g(G) ≥ 1 is bounded and ∆(G) ≥ 4 5 + 48g(G) + 1 /2 ; and
2
n − |U | < n. (12)
2∆ + 1
Edges in E(G) − E 0 either join two vertices in W or are incident to vertices
in V −U −W . The number of former edges is at most a0 (G)|W |, and the number
of latter edges is at most ∆(n − |U | − |W |). Therefore we have
|E 0 | ≥ m − a0 (G)|W | − ∆(n − |U | − |W |)
= m − ∆(n − |U |) + (∆ − a0 (G))|W |. (13)
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 10
Lemma 5 If ∆(G) is bounded and ∆(G) ≥ 4a0 (G), then G can be edge-colored
by ∆(G) colors in O(n log n) sequential time or in O(log3 n) parallel time with
O(n log3 n) operations.
4s(G) > 2s(Gi ) and hence χ0 (Gi ) = ∆(Gi ) for each i, 1 ≤ i ≤ j. Since
∆(Gi ) < 2c = 8s(G) ≤ 16a0 (G) = O(1) by Lemma 2, ∆(Gi ) is bounded for
1 ≤ i ≤ j. Furthermore ∆(Gi ) ≥ 4s(G) ≥ 4s(Gi ) ≥ 4a0 (Gi ) by Eqs. (3) and
(5). Therefore by Lemma 5 one can find an edge-coloring of Gi with ∆(Gi )
colors in the claimed time. Since
j
X
∆(G) = ∆(Gi ),
i=1
EDGE-COLOR(G);
{ assume that a0 (G) is bounded and ∆(G) ≥ 4a0 (G) }
begin
if ∆(G) < 8s(G) then {∆(G) is bounded }
1. edge-color G with ∆(G) colors by Lemma 5;
else {∆(G) ≥ 8s(G)}
begin
2. find a (∆, 4s(G))-partition E1 , E2 , · · · Ej of E(G);
3. for i := 1 to j do
edge-color of Gi with ∆(Gi ) colors where Gi = G[Ei ];
4. extend these optimal edge-colorings of G1 , G2 , · · · , Gj
to an optimal edge-coloring of G with ∆(G) colors
end
end;
Since the unicyclic index a0 (G) is bounded, |E| = O(n). Thus line 3 can be
totally done in O(n log n) sequential time or in O(log3 n) parallel time with
P
O(n log3 n) operations. At line 4, since ∆(G) = ji=1 ∆(Gi ), one can immedi-
ately superimpose these edge-colorings of G1 , G2 , · · · , Gj to an edge-coloring of
G with ∆(G) colors. Thus the algorithm spends O(n log n) sequential time in
total or in O(log3 n) parallel time with O(n log3 n) operations. 2
It should be noted that the algorithm EDGE-COLOR does not need to know
an actual decomposition of G into a(G) unicyclic subgraphs.
5 f -Coloring
In this section we give efficient sequential and NC parallel algorithms for the
f -coloring problem on various classes of graphs.
We first show that the f -coloring problem on a graph G can be reduced to
the edge-coloring problem on a new graph Gf defined below. We may assume
without loss of generality that f (v) ≤ d(v) for each v ∈ V . For each vertex
v ∈ V , replace v with f (v) copies v1 , v2 , · · · , vf (v) , and attach the d(v) edges
incident with v to the copies; attach dd(v)/f (v)e or bd(v)/f (v)c edges to each
copy vi , 1 ≤ i ≤ f (v). Let Gf be the resulting graph. It should be noted that
the construction of Gf is not unique. Figure 2 illustrates G and an example
of Gf , where the number next to vertex v is f (v). Since an edge-coloring of
Gf immediately induces an f -coloring of G with the same number of colors, we
have
However, Eq. (14) does not always hold in equality. For example, χ0f (G) = 2 for
a graph G in Figure 2(a) as indicated by solid and dotted lines, but χ0 (Gf ) = 3
for the graph Gf in Figure 2(b) as indicated by thin, thick and dotted lines.
Clearly ∆(Gf ) = ∆f (G) = maxv∈V dd(v)/f (v)e. If G is a simple graph, then
Gf is also a simple graph and hence χ0 (Gf ) ≤ ∆(Gf ) + 1 = ∆f (G) + 1. Thus an
edge-coloring of Gf with χ0 (Gf ) colors does not always induce an f -coloring of
G with χ0f (G) colors, but induces a near-optimal f -coloring of G with at most
∆f (G) + 1 colors.
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 13
1
1 1
1 1
2
3
1
2 2
1 1
1 1
(a) G (b) G
f
Lemma 8 Let G be a class of graphs which are closed under the transformation
above, that is, any Gf is contained in G for every G ∈ G, and let α and β be
real numbers. Then the following (a) and (b) hold.
(a) If there exists a sequential algorithm to edge-color any graph G0 ∈ G by
α∆(G0 ) + β colors in polynomial time T (m(G0 ) + n(G0 )), then there exists
a sequential algorithm to f -color any graph G ∈ G by α∆f (G) + β colors
in O(T (m(G) + n(G))) time.
(b) If there exists a parallel algorithm to edge-color any graph G0 ∈ G by
α∆(G0 ) + β colors in polylogarithmic parallel time T (m(G0 ) + n(G0 )) with
polynomial operations P (m(G0 ) + n(G0 )), then there exists a parallel algo-
rithm to f -color any graph G ∈ G by α∆f (G) + β colors in O(T (m(G) +
n(G))) parallel time with O(P (m(G) + n(G))) operations.
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 14
Proof: Proofs of (a), (b), (c), (e), (f), (g) and (i) are immediate. If G is a
partial k-tree, then Gf is not always a partial k-tree, but s(G) ≤ k. Therefore
(d) above is an immediate consequence of (c). If g(G) ≥ 1 and
j p k
∆f (G) ≥ 2 5 + 48g(G) + 1 /2 ,
then ∆f (G) = ∆(Gf ) ≥ 12 and hence χ0f (G) ≤ χ0 (Gf ) = ∆(Gf ) = ∆f (G) even
if g(Gf ) = 0. Thus (h) follows. 2
By Theorem 3, Corollary 2, Lemmas 7, 8 and the algorithms in [3, 6, 12],
we have the following results.
Theorem 5
(b) Any bipartite graph G can be f -colored by ∆f (G) colors in O(m log n)
time.
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 15
(c) Graph G can be f -colored by ∆f (G) colors in O(n log n) time if one of the
following (i) – (viii) holds:
(i) G belongs to a minor closed class G and ∆f (G) ≥ 4h(G);
(ii) a0 (G) is bounded and ∆f (G) ≥ 4a0 (G);
(iii) a(G) is bounded and ∆f (G) ≥ 4a(G);
(iv) s(G) is bounded and ∆f (G) ≥ 4s(G);
(v) k(G) is bounded and ∆f (G) ≥ 4k(G);
(vi) θ(G) is bounded and ∆f (G) ≥ 12θ(G);
j p k
(vii) g(G) ≥ 1 is bounded and ∆f (G) ≥ 4 5 + 48g(G) + 1 /2 ; and
(viii) G is planar and ∆f (G) ≥ 9.
Proof: (a) The algorithm in [12] edge-colors Gf with ∆(Gf ) + 1 colors in time
p
O(min{mf ∆f log nf , mf mf log nf }),
Theorem 6
(a) Any bipartite graph G can be f -colored by ∆f (G) colors in O(log3 n) par-
allel time with O(m) operations.
(b) Graph G can be f -colored by ∆f (G) colors in O(log3 n) parallel time with
O(n log3 n) operations if one of the following (i) – (viii) holds:
(i) G belongs to a minor closed class G and ∆f (G) ≥ 4h(G);
(ii) a0 (G) is bounded and ∆f (G) ≥ 4a0 (G);
(iii) a(G) is bounded and ∆f (G) ≥ 4a(G);
(iv) s(G) is bounded and ∆f (G) ≥ 4s(G);
(v) k(G) is bounded and ∆f (G) ≥ 4k(G);
(vi) θ(G) is bounded and ∆f (G) ≥ 12θ(G);
j p k
(vii) g(G) ≥ 1 is bounded and ∆f (G) ≥ 4 5 + 48g(G) + 1 /2 ; and
(viii) G is planar and ∆f (G) ≥ 9.
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 16
6 Conclusion
In this paper we first gave efficient sequential and NC parallel algorithms to
edge-color graph G with ∆(G) colors if a0 (G) is bounded and ∆(G) ≥ 4a0 (G),
where a0 (G) is the unicyclic index of G. Our algorithms are based on the
following two algorithms: the edge-coloring algorithm (for planar graphs) by
Chrobak and Nishizeki [3], and the algorithm for decomposing a graph of large
maximum degree to edge-disjoint subgraphs of small maximum degrees by Zhou,
Nakano and Nishizeki [32]. We next introduced a simple but useful reduction
of an f -coloring to an ordinary edge-coloring, and derived various sufficient
conditions for χ0f (G) = ∆f (G) to hold true. Using the reduction, we finally
gave efficient sequential and NC parallel f -coloring algorithms.
Acknowledgments
We would like to thank Dr. Hitoshi Suzuki and Dr. Shin-ichi Nakano for helpful
comments and discussions. This research is partly supported by Grant in Aid
for Scientific Research of the Ministry of Education, Science, and Culture of
Japan under a grant number: General Research (C) 07650408.
References
[1] M. Behzad, G. Chartrand, and L. Lesniak-Foster. Graphs and Digraphs.
Pindle, Weber & Schmidt, Boston, 1979.
[2] Y. Caspi and E. Dekel. Edge coloring series parallel graphs. Journal of
Algorithms, 18:296–321, 1995.
[3] M. Chrobak and T. Nishizeki. Improved edge-coloring algorithms for planar
graphs. Journal of Algorithms, 11:102–116, 1990.
[4] M. Chrobak and M. Yung. Fast algorithms for edge-coloring planar graphs.
Journal of Algorithms, 10:35–51, 1989.
[5] E. G. Coffman, J. M. R. Garey, D. S. Johnson, and A. S. LaPaugh. Schedul-
ing file transfers. SIAM J. Comput., 14(3):744–780, 1985.
[6] R. Cole and J. Hopcroft. On edge coloring bipartite graphs. SIAM J.
Comput., 11:540–546, 1982.
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 17
[23] D. Matula and L. Beck. Smallest-last ordering and clustering and graph
coloring algorithms. JACM, 30:417–427, 1983.
[24] S. Nakano and T. Nishizeki. Scheduling file transfers under port and chan-
nel constraints. Int. J. Found. of Comput. Sci., 4(2):101–115, 1993.
[25] S. Nakano, T. Nishizeki, and N. Saito. On the f -coloring of multigraphs.
IEEE Transactions on Circuits and Systems, CAS-35, 3:345–353, 1988.
[26] C. S. J. A. Nash-Williams. Edge-disjoint spanning trees of finite graphs. J.
London Math. Soc., 36:445–450, 1961.
[27] T. Nishizeki and N. Chiba. Planar Graphs: Theory and Algorithms. North-
Holland, Amsterdam, 1988.
[28] G. Szekeres and H. Wilf. An inequality for the chromatic number of a
graph. J. Combinatorial Theory, 4:1–3, 1968.
[29] O. Terada and T. Nishizeki. Approximate algorithms for the edge-coloring
of graphs. Trans. Inst. of Electronics and Communication Eng. of Japan,
J65-D, 11(4):1382–1389, 1982.
[30] V. G. Vizing. On an estimate of the chromatic class of a p-graph (in
Russian). Metody Discret Analiz., 3:25–30, 1964.
[31] V. G. Vizing. Critical graphs with given chromatic class (in Russian).
Metody Discret. Analiz., 5:9–17, 1965.
[32] X. Zhou, S. Nakano, and T. Nishizeki. Edge-coloring partial k-trees. Jour-
nal of Algorithms, 21:598–617, 1996.
[33] X. Zhou and T. Nishizeki. Edge-coloring and f -coloring for various classes
of graphs. In Proc. of the Fifth International Symposium on Algorithms and
Computation, Lect. Notes in Computer Science, Springer-Verlag, volume
834, pages 199–207, 1994.
[34] X. Zhou, H. Suzuki, and T. Nishizeki. A linear algorithm for edge-coloring
series-parallel multigraphs. Journal of Algorithms, 20:174–201, 1996.
[35] X. Zhou, H. Suzuki, and T. Nishizeki. An NCparallel algorithm for edge-
coloring series-parallel multigraphs. Journal of Algorithms, 23:359–374,
1997.
Journal of Graph Algorithms and Applications
http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 2, pp. 1–23 (1999)
Abstract
We report on the results of an experimental study in which we have
compared the performances of three algorithms for drawing general cubic
graphs on the bidimensional orthogonal grid. The comparison works on
18,000 randomly generated graphs with up to 300 vertices and analyzes
the number of bends and crossings, the area, the edge length and the
running time.
1 Introduction
An orthogonal grid drawing of a graph is a drawing such that the edges are
polygonal chains consisting of horizontal and vertical segments and the vertices
have integer coordinates. The graphs that admit such a drawing must have
maximum degree 4. Among these graphs, cubic graphs (i.e. regular graphs
of degree 3) and at most cubic graphs (i.e. graphs having bounded degree
3), constitute interesting and complex classes of graphs, despite their apparent
simplicity. Indeed, cubic graphs are a natural model for a large number of
real systems that interest many scientific fields such as Psychology, Probability,
Economy, Physics, Geometry, and Computer Science. More in detail, some
concrete examples are the study of the interaction of quantistic charged particles
of high energy [4] and the study of flowgraphs to design hierarchical software
metrics [21], see Figs. 1 and 2.
x1(t1) y1(t1)
x(t)
y(t)
x2(t2)
y2(t2)
c
a
We have chosen these algorithms because they are homogeneous with respect
to the input, the output and the leading idea. In particular, in our experimenta-
tion, no restriction on the input is required: neither planarity nor biconnectivity,
nor a preliminary layout. This is the main reason why we have decided not to
include in our experimentation algorithms such as those presented in [3, 17, 22],
which deal with planar and/or triconnected graphs only. For what concerns the
output, it is accepted to be non plane, even if the input graph is planar. The
chosen algorithms add one vertex at a time according to an st-numbering [13];
therefore, the algorithm described in [20] has not been considered because it
works on pairs of vertices. All the algorithms first work on biconnected compo-
nents and then splice the drawings of the components to form a drawing of the
entire graph. Thus, the results of our experiments are reported in two series
of diagrams, one for biconnected graphs and the other for simply connected
graphs.
Observe that the algorithm by Biedl and Kant is the only algorithm, among
the chosen ones, not to be explicitly designed for cubic graphs. We have included
this algorithm in the experimentation also to check if designing a drawing algo-
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 4
rithm specifically for cubic graphs can improve its performance. The answer to
this question is discussed in Section 5. Finally, the chosen algorithms achieve
the best theoretical results known in the literature for a general at most cubic
graph in minimizing the area, the total number of bends and the running time.
The rest of this paper is organized as follows: in Section 2, some basic
definitions are given. In Section 3, the three analyzed drawing algorithms are
sketched outlining the similarities and underlining the differences. Section 4
contains the results of the experiments (summarized in twelve diagrams) and a
comparative analysis of the performance of the algorithms. Finally, in Section 5,
we show drawings of the same graph generated by the three algorithms and offer
concluding remarks.
2 Basic Definitions
In this section we introduce some preliminary concepts related to the topics
dealt in this paper.
In the following the four directions on the grid with respect to each vertex
are distinguished and a direction is called free with respect to a vertex if no edge
is present on it.
Observe that a nontrivial biconnected graph cannot have any vertex of de-
gree 1. When we deal with biconnected graphs, we will assume that the input
graph is cubic. Indeed, if it is at most cubic, we can first eliminate each ver-
tex of degree 2 by merging its incident edges. After drawing the resulting cubic
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 5
i i
i i
x x
j j
j j
Definition 4 [13] Given any edge {s, t} of a biconnected graph G = (V, E),
a function g : V → {1, 2, . . . , n} is called an st-numbering if the following
conditions hold:
• With respect to the number of bends per edge, all three algorithms reach
a constant value, either 1 or 2. In particular, the output of algorithm CP
is exactly a 1-bend drawing of G; the output of PT is 1-bend except at
most one edge incident to n (Fig. 4) while the output of BK is 2-bend.
Notice that the introduction of 2 bends per edge arises from the fact that
this algorithm has been designed for graphs with bounded degree 4.
• Both Algorithm CP and PT use the concept of movement of bends, al-
ready introduced in [18]. The movement of a bend consists of moving
a vertex k along an edge in order to change its free directions (Fig. 5).
This has also the effect of changing the position of a bend, while the total
number of bends stays the same.
In Algorithm CP it is possible to change the free directions of a vertex
also through a rotation. This operation does not guarantee the invariance
of the number of bends; in Fig. 6 a possible rotation is shown.
• All the algorithms divide the input graph into its biconnected components
and run a pre-processing phase computing an st-numbering. Then, one
by one, each biconnected component is drawn; finally, the whole draw-
ing of the graph is obtained by connecting the drawings of the different
components.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 7
k k
j j
i i
k j j
i i
• The basic idea of the first phase consists of adding the vertices to the draw-
ing one at a time ordered according to an st-numbering. This construction
is made for each biconnected component and it is based on the existence,
in an st-numbered graph, of edges {1, 2}, {n − 1, n} and, for each vertex
j (where j 6= 1, n), of edges {j, i} and {j, l} such that i < j < l.
Let G k = (Vk , Ek ) be the subgraph induced by the first k vertices in the st-
numbering (Vk = {1, 2, . . . , k}) and Dk a drawing for G k . During the k-th
step, vertex k and the edges {i, k}, with i < k, are added to Dk−1 . Each
author has his/her own rules to lay vertex k out, and they constitute the
main reason of the difference between the three algorithms. In particular,
Algorithm BK, at each step, associates with a free direction of k an edge
incident to k that will be drawn in a successive step (Fig. 7).
Algorithms CP and PT draw k in such a way that at least one and at
most two edges do not introduce any bend.
• The final difference we want to highlight is the addition of vertex n to
Dn−1 . Algorithm CP places vertex n and its edges on the grid as a comb
graph (Fig. 8) after having possibly operated a rotation or a movement of
some bends.
Beside the comb graph, Algorithm PT must accept also the configuration
of Fig. 4 for n because this algorithm does not provide any rotation.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 8
1 2
• Area: area of the smallest rectangle with horizontal and vertical sides
covering the drawing;
• Bends: total number of bends;
• Crossings: total number of edge-crossings;
• MaxEdgeLen: maximum length of any edge;
• TotalEdgeLen: total edge length;
• Time: CPU time (measured in milliseconds) to compute the geometry
of the drawing, including the st-numbering computation but excluding
both the graph generation time and the time for drawing on screen. The
resolution is 0.2 ms.
4.3 Implementation
The algorithms have been implemented in C and have been run on a computer
with a Pentium MMX 166 MHz processor.
A technical problem faced during the implementation of all three algorithms
is the maintenance of the vertex coordinates during the incremental construction
of the drawing. Indeed, when adding a new row or column to the drawing to
accommodate the placement of the next vertex, the coordinates of many vertices
and bends may need to be updated. This implies that it is not possible to
compute the final coordinates of each vertex as it is added to the drawing.
By representing the “virtual” coordinates by means of two sorted lists, this
problem is reduced to the problem of maintaining order in a list, for which an
optimal linear-time solution using sophisticated techniques is given by Dietz and
Sleator [12]. In our implementation we have opted instead for a simple linear-
time method that experimentally works very well but that is not guaranteed to
always give correct results, although it never failed in our experimentations.
Our method uses temporary floating-point coordinates for the vertices during
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 11
the execution of the algorithm. Namely, consider the insertion of a new vertex
k on a new row (column) between the rows (columns) where its two adjacent
vertices i and j lie. W.l.o.g., suppose that yj < yi (xj < xi ) and let yb (xb ) be
the first occupied row (column) in the range [yj , yi ] ([xj , xi ]) after yj (xj ). This
is the value immediately following yj (xj ) in the sorted list of y (x) coordinates.
We assign to vertex k y- (x-)coordinate equal to the average of yj and yb (xj and
xb ) and update the sorted list by inserting yk (xk ) is after yj (xj ) and before yb
(xb ). At the end of the construction of the drawing we transform the temporary
floating-point coordinates into final integer coordinates in linear time, with a
simple prefix sum algorithm.
The above algorithm may yield incorrect results if there is a long succession
of vertices k1 , . . . , ks with the following property:
• k1 lies between i and j;
• kr (r = 2, . . . , s) lies between kr−1 and i.
For typical processors, errors occur if s ≥ 36, an event that never occurred in
our experiments.
Another minor problem was that our implementation of Algorithm PT failed
on some input graphs. This is due to the fact that the original description of the
algorithm does not mention how to deal with certain special cases (see Fig. 9).
4.4 Analysis
In this section, we discuss the results of the experiments and analyze in detail
the various performance indicators.
• Area: (Figs. 10 and 11) Algorithm PT yields average area very close to
the theoretical bound of n2 /4 + o(n2 ), both in the connected and in the
biconnected case.
The area of drawings computed by Algorithm BK is n2 /2 both in the con-
nected and biconnected case. But, while this value matches the theoretical
value of the area for biconnected graphs, it is slightly better than 9n2 /16,
which is the theoretical bound for connected graphs. This suggests that
the configurations leading to the larger theoretical value for the area in
the connected case are rare.
Finally, since Algorithm CP tries to draw vertices without adding new
bends and therefore without adding new rows and columns, it reaches a
slightly better area bound (about n2 /4.88 instead of n2 /4) both in the
connected and in the biconnected case.
• Bends: (Figs. 12 and 13) For what concerns the total number of bends, it
is clear from the diagrams that all three algorithms generate fewer bends
in the simply connected case than in the biconnected one.
Namely, BK generates a total number of bends that is close to n for
biconnected graphs and close to n/1.25 for connected graphs. Algorithm
PT approaches n/2 and n/2.5 in the biconnected and connected case,
respectively. Algorithm CP works better from this point of view, since it
generates about n/2.44 and n/3 bends if the input graph is biconnected
and connected, respectively. Also, the ratio between the averages of the
numbers of bends in the biconnected and connected case is about 1.22 in
all algorithms: the better results in the biconnected case can be justified
by the lower number of edges on average.
• Crossings: (Figs. 14 and 15) The total number of crossings does not
appear to be an increasing function of the number of vertices because
the number of crossings is highly random. Since edges connecting the
biconnected components are always drawn without crossings, their number
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 13
40000
35000
30000
25000
20000
15000
10000
5000
0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
Area
Number of vertices
BK PT CP
Figure 10: Area versus number of vertices for simply connected graphs.
40000
35000
30000
25000
20000
15000
10000
5000
0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
Area
Number of vertices
BK PT CP
240
200
160
120
80
40
0
number 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
of bends number of vertices
BK PT CP
Figure 12: Total number of bends versus number of vertices for simply connected
graphs.
320
280
240
200
160
120
80
40
0
number 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
of bends number of vertices
BK PT CP
Figure 13: Total number of bends versus number of vertices for biconnected
graphs.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 15
1000
800
600
400
200
0
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
number of
crossings number of vertices
BK PT CP
Figure 14: Crossings versus number of vertices for simply connected graphs.
5000
4800
4600
4400
4200
4000
3800
3600
3400
3200
3000
2800
2600
2400
2200
2000
1800
1600
1400
1200
1000
800
600
400
200
0
A
A
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
number of number of vertices
crossings
BK PT CP
400
300
200
100
0
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
Max Edge
number of vertices
Length
BK PT CP
Figure 16: Maximum edge length versus number of vertices for simply connected
graphs.
400
300
200
100
0
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
Max Edge
Length number of vertices
BK PT CP
Figure 17: Maximum edge length versus number of vertices for biconnected
graphs.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 17
14000
12000
10000
8000
6000
4000
2000
0
Total Edge 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
number of
Length BK vertices
PT CP
Figure 18: Total edge length versus number of vertices for simply connected
graphs.
26000
24000
22000
20000
18000
16000
14000
12000
10000
8000
6000
4000
2000
0
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
Total Edge number of
Length vertices
BK PT CP
Figure 19: Total edge length versus number of vertices for biconnected graphs.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 18
0
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
computational number of vertices
time
BK PT CP
Figure 20: Computational time (in ms) versus number of vertices for simply
connected graphs.
0
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300
computational number of vertices
time
BK PT CP
Figure 21: Computational time (in ms) versus number of vertices for biconnected
graphs.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 19
is consistently smaller when the graphs are simply connected rather than
when they are biconnected. The average values in the biconnected case are
n2 /33, n2/25.8 and n2 /17.6 for Algorithms BK, CP and PT, respectively.
The good result of BK can be explained as a consequence of the fact that
it is designed to support the drawing of planar graphs without crossings,
and therefore its number of crossings is lower, to the detriment of the area.
• Computational time: (Figs. 20 and 21) All three algorithms are very
fast: PT runs in n/54 and n/50 ms on connected and biconnected graphs,
respectively; BK and CP need n/48(n/47) and n/47(n/44) ms to draw
an n vertex connected and biconnected cubic graph, respectively.
5 Conclusions
Following the trend of comparing the theoretical properties of graph drawing
algorithms with experimental results and of estimating performance indicators,
in this paper we analyze three algorithms for constructing orthogonal grid draw-
ings of cubic graphs. The main conclusion of our work is that this problem is
well solved both from a theoretical and an experimental point of view.
Analyzing more in detail the results of the experimentation, we see that the
best algorithm depends on the criteria used. If the most important objective is
either the area or the maximum number of bends or the edge length, the best
algorithm is CP. According to the computational time PT beats the other two.
A partial justification of why BK performs best only regarding the number of
crossings lies in its goals: to draw graphs with maximum degree 4 and to focus
on planar graphs.
To conclude, we give an example of the layouts produced by the three algo-
rithms by running them on the graph of Fig. 22. Figs. 23, 24 and 25 show the
drawings generated by Algorithms BK, CP and PT, respectively.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 20
References
[1] A. Aho, J. K. Hopcroft, and J. D. Ullman. The design and analysis of com-
puter algorithms. Addison Wesley, Reading, MA, 1973.
[2] T. Biedl, and G. Kant. A Better Heuristic for Orthogonal Graph Drawings.
Comput. Geom. Theory Appl., 9:159–180, 1998. Also in Proc. European
Symposium on Algorithms (ESA ’94), Lectures Notes in Computer Science
855, Springer-Verlag, pages 24–35, 1994.
[3] T. Biedl. Optimal plane orthogonal drawings for triconnected graphs. In
Proc. Scandinavian Workshop on Algorithm Theory (SWAT’96), Lectures
Notes in Computer Science 1097, Springer-Verlag, pages 333–344, 1996.
[4] J.D. Bjorken, and S.D. Drell. Relativistic Quantum Fields. Mc-Graw Hill,
New York, 1965.
[5] T. Calamoneri. Does Cubicity Help to Solve Problems? Ph.D. Thesis, Uni-
versity of Rome “La Sapienza”,XI-2-97, 1997.
[6] T. Calamoneri, and R. Petreschi. An Efficient Orthogonal Grid Drawing
Algorithm for Cubic Graphs. In Proc. First Annual International Confer-
ence on Computing and Combinatorics (COCOON ’95), Lectures Notes in
Computer Science 959, Springer-Verlag, pages 31–40, 1995.
[7] T. Calamoneri, and R. Petreschi. Orthogonal Drawing Cubic Graphs in Par-
allel. J. Parallel and Distr. Comput., 55:94–108, 1998.
[8] G. Di Battista, A. Garg, G. Liotta, R. Tamassia, E. Tassinari, and F. Vargiu.
An Experimental Comparison of Three Graph Drawing Algorithms. In
ACM Symposium on Computational Geometry, ACM, pages 306–315, 1995.
[9] G. Di Battista, A. Garg, G. Liotta, R. Tamassia, E. Tassinari, and F. Vargiu.
An Experimental Comparison of Four Graph Drawing Algorithms. Comp.
Geom., 7(5-6):303–325, 1997.
[10] G. Di Battista, A. Garg, G. Liotta, A. Parise, R. Tamassia, and E. Tassinari.
Drawing Directed Acyclic Graphs: An Experimental Study. In Proc. Graph
Drawing (GD’96), Lectures Notes in Computer Science 1190, Springer-
Verlag, pages 76–91, 1996.
[11] G. Di Battista, G. Liotta, and F. Vargiu. Spirality and Optimal Orthogonal
Drawings. SIAM J. Comput., 27(6):1764–1811, 1998.
[12] P. F. Dietz, and D. D. Sleator. Two algorithms for maintaining order in a
list. In Proc. 19th ACM Symp. on Theor. Comp. Sci. (STOC ’87), 2, pages
436–441, 1976.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 23
Abstract
We solve the subgraph isomorphism problem in planar graphs in linear
time, for any pattern of constant size. Our results are based on a tech-
nique of partitioning the planar graph into pieces of small tree-width, and
applying dynamic programming within each piece. The same methods
can be used to solve other planar graph problems including connectivity,
diameter, girth, induced subgraph isomorphism, and shortest paths.
Work supported in part by NSF grant CCR-9258355 and by matching funds from
Xerox Corp.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 2
1 Introduction
Subgraph isomorphism is an important and very general form of exact pattern
matching. Subgraph isomorphism is a common generalization of many impor-
tant graph problems including finding Hamiltonian paths, cliques, matchings,
girth, and shortest paths. Variations of subgraph isomorphism have also been
used to model such varied practical problems as molecular structure compar-
ison [2], integrated circuit testing [10], microprogrammed controller optimiza-
tion [26], prior-art avoidance in genetic evolution of circuits [33], analysis of Chi-
nese ideographs [27], robot motion planning [34], semantic network retrieval [36],
and polyhedral object recognition [44].
In the subgraph isomorphism problem, given a “text” G and a “pattern”
H, one must either detect an occurrence of H as a subgraph of G, or list all
occurrences. For certain choices of G and H there can be exponentially many
occurrences, so listing all occurrences can not be solved in subexponential time.
Further, the decision problem is NP-complete. However for any fixed pattern
H with ` vertices, both the enumeration and decision problems can easily be
solved in polynomial O(n` ) time, and for some patterns an even better bound
might be possible. Thus one is led to the problem of determining the algorithmic
complexity of subgraph isomorphism for a fixed pattern.
Here we consider the special case in which G (and therefore H) are planar
graphs, a restriction naturally occurring in many applications. We show that
for any fixed pattern, planar subgraph isomorphism can be solved in linear
time. Our results extend to some other problems including vertex connectivity,
induced subgraph isomorphism and shortest paths.
Our algorithm uses a graph decomposition method similar to one used by
Baker [6] to approximate various NP-complete problems on planar graphs. Her
method involves removing vertices from the graph leaving a disjoint collection
of subgraphs of small tree-width; in contrast we find a collection of non-disjoint
subgraphs of small tree-width covering the neighborhood of every vertex.
We assume throughout that all planar graphs are simple, so that the number
of edges is at most O(n); this simplifies our time bounds as we need not include
the dependence on this number. The only problems for which this assumption
makes a difference are induced subgraph isomorphism, h-clustering, and edge
connectivity; for those, one can assume without loss of generality that the graph
has bounded edge multiplicity, so again m = O(n).
2 New Results
We prove the following results. The time dependence on H is omitted from
these bounds. In general it is exponential (necessarily so, unless P=NP, since
planar subgraph isomorphism is NP-complete) but see Theorem 3 for situations
in which it can be improved.
• We can test whether any fixed pattern H is a subgraph of a planar graph G,
or count the number of occurrences of H as a subgraph of G, in time O(n).
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 3
3 Related Work
For general subgraph isomorphism, nothing better than the naive exponential
O(n|H| ) bound is known. Plehn and Voigt [41] give an algorithm
√ for subgraph
O(|H|) O( |H|)
isomorphism which in planar graphs takes
√ time |H| n (since im-
proved by Alon et al. [1] to 2O(|H|) nO( |H|) ), but this is still much larger than
the linear bound we achieve.
Several papers have studied planar subgraph isomorphism with restricted
patterns. It has long been known that if the pattern H is either K3 or K4 , then
there can be at most O(n) instances of H as a subgraph of a planar graph G,
and that these instances can be listed in linear time [7, 28, 40], a fact which
has been used in algorithms to test connectivity [35], to approximate maximum
independent sets [7], and to test inscribability [14]. Linear time and instance
bounds for K3 and K4 can be shown to follow solely from the sparsity properties
of planar graphs [12, 13], and similar methods also generalize to problems of
finding K2,2 and other complete bipartite subgraphs [12, 17]. Richards [42] gives
O(n log n) algorithms for finding C5 and C6 subgraphs in planar graphs, and
leaves open the question for larger cycle lengths; Alon et al. [1] gave O(n log n)
deterministic and O(n) randomized algorithms for larger cycles. In [16], we
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 4
showed how to list all cycles of a given fixed length in outerplanar graphs, in
linear time (see also [37, 38, 39, 45] for similar variants of outerplanar subgraph
isomorphism). We used our outerplanar cycle result to find any wheel of a given
fixed size in planar graphs, in linear time. Itai and Rodeh [28] discuss the
problem of finding the girth of a general graph, or equivalently that of finding
short cycles. The problem of finding cycles in planar graphs was discussed above.
Fellows and Langston [20] discuss the related problem of finding a path or cycle
longer than some given length in a general graph, which they solve in linear
time for a given fixed length bound. The planar dual to the shortest separating
cycle problem has been related by Bayer and Eisenbud [8] to the Clifford index
of certain algebraic curves. Our results here generalize and unify this collection
of previously isolated results, and also give improved dependence on the pattern
size in certain cases.
Recently we were able to characterize the graphs that can occur at most O(n)
times as a subgraph isomorph in an n-vertex planar graph: they are exactly the
3-connected planar graphs [16]. However our proof does not lead to an efficient
algorithm for 3-connected planar subgraph isomorphism. In this paper we use
different techniques which do not depend on high-order connectivity.
Laumond [35] gave a linear time algorithm for finding the vertex connec-
tivity of maximal planar graphs. Eppstein et al. [19] give an O(n) time algo-
rithm for testing k-edge-connectivity for k ≤ 4 and k-vertex-connectivity for
k ≤ 3. For general graphs, testing k-edge-connectivity for fixed k takes time
O(m + n log n) [25]. 4-vertex-connectivity in general graphs can be tested in
time O(nα(n) + m) [29]. However planar graphs can be as much as 5-vertex-
connected, and nothing even close to linear was known for testing planar 5-
connectivity.
Our shortest path data structure combines our methods of bounded tree-
width decomposition with a separator-based divide and conquer technique due
to Frederickson [21]. Obviously all pairs shortest paths can be computed in time
O(nm) after which the queries we describe can be answered in time O(1), but
some faster algorithms are known for approximate planar shortest paths [23, 24,
31]. Our data structure answers shortest path queries exactly, in less prepro-
cessing time than the other known results, but can only find paths of constant
length.
A final note of caution is in order. One should not be confused by the
superficial similarity between the subgraph isomorphism problems posed here
and the graph minor problems studied extensively by Robertson, Seymour, and
others [43]. One can recognize path subgraphs by minor testing, but such tricks
do not work for most other subgraph isomorphism problems. The absence of
a fixed minor imposes severe structural constraints on a graph, whereas this is
much less the case when a fixed subgraph is not present. Although minor testing
can be done in time polynomial in the text graph size, the constant factors are
typically much higher than those for our subgraph isomorphism algorithm.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 5
A G
{ A, F, G, H }
F H
{ A, F, H, M }
B
{ A, E, F, M } { F, H, K, M }
E K
L { A, D, E, M } { H, K, L, M }
C
{ A, C, D, E }
D { A, B, C, E }
M
A G
F H
F H
x
K
E K
L
D M
M
Proof: The only property of a tree decomposition that does not follow imme-
diately is the requirement that each edge connect two vertices contained in the
label of some node. Since this is true of G and T , any induced subgraph edge
(u, v) must have {u, v} ⊂ L(N 0 ) for some N 0 , but N 0 may not be a descendant
of N . However, if not, u belongs to both L(N 0 ) and (by assumption) L(N 00 )
where N 00 is a descendant of N . Therefore, by contiguity, u ∈ L(N ), and sim-
ilarly v ∈ L(N ), so in this case (u, v) still both belong to the label of at least
one node in the subtree. 2
Lemma 2 Assume we are given graph G with n vertices along with a tree de-
composition T of G with width w. Let S be a subset of the vertices of G, and
let H be a fixed graph with at most w vertices. Then in time 2O(w log w) n we
can count all isomorphs of H in G that include some vertex in S. We can list
all such isomorphs in time 2O(w log w) n + O(kw), where k denotes the number of
isomorphs and the term kw represents the total output size.
to all vertices in L(n), and each of the two additional vertices also is given a
self-loop. Then from any partial isomorph at N we can derive a graph homo-
morphism from all of H to G0 , which is one-to-one on vertices in L(N ), maps the
rest of H 0 to x, and maps H − H 0 to y. Let a partial isomorph boundary be such
a map; Figure 2 illustrates a partial isomorph and the corresponding boundary.
Since a partial isomorph boundary consists of a map from a set of at most w
objects to a set of at most w + 3 objects, there are at most w w+3 = 2O(w log w)
possible partial isomorph boundaries for a given node.
Suppose that node N has children N1 and N2 We say that two partial
isomorph boundaries B : H 7→ G0N and B1 : H 7→ G0N1 are consistent if the
following conditions all hold:
• For each vertex v ∈ H, if B(v) ∈ L(N1 ) or B1 (v) ∈ L(N ), then B(v) =
B1 (v).
The total time for testing all triples for compatibility and performing the
above computation is O(w 3(w+3)+1 = 2O(w log w) .
At the root node of the tree, we compute the number of isomorphs involving
S simply by summing the values X2 (B) over all partial isomorph boundaries
for which B(v) 6= y for all v. 2
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 8
Lemma 3 Assume we are given graph G with n vertices along with a tree de-
composition T of G with width w. Let S be a subset of the vertices of G, and
let H be a fixed graph with at most w vertices. Then we can list all isomorphs
of H in G that include some vertex in S in time 2O(w log w) n + O(kw), where
k denotes the number of isomorphs and the term kw represents the total output
size.
5 Neighborhood Covers
We have seen above that we can perform subgraph isomorphism quickly in
graphs of bounded tree-width. The connection with planar graphs is the follow-
ing:
Lemma 4 (Baker [6]) Let planar graph G have a rooted spanning tree T in
which the longest path has length `. Then a tree decomposition of G with width
at most 3` can be found in time O(`n).
Proof: Without loss of generality (by adding edges if necessary) we can assume
G is embedded in the plane with all faces triangles (including the outer face).
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 9
A
{ A,B,C }
{A
}
,C
D
,D
,D
,C
}
,B
{A
{ A,D,E,F }
{A
}
,C
,E
E F ,D
,D
{ A,C,D, ,F
,C
}
,B
E,F,G }
{A
G
G} {A
,E, ,C,
D,F
C,D ,G
,B, }
{A
{ A,B,C,G }
B C
Figure 3: Triangulated planar graph, with depth two tree T rooted at A (shown
by heavy solid lines), and tree decomposition with nodes corresponding to faces
of the graph and edges complementary to T .
Form a tree with one node per triangle, and an edge connecting any two nodes
whenever the corresponding triangles share an edge that is not in T (Figure 3).
Label each node with the set of vertices on the paths connecting each corner
of the triangle to the root of the tree. Then each edge’s endpoints are part of
some label set (namely, the sets of the two triangles containing the edge), and
the labels containing any vertex form a contiguous subtree (namely, the path
of triangles connecting the two triangles containing the edge from the vertex
to its parent, and any other triangles enclosed in the embedding by this path).
Therefore, this gives us a tree decomposition of G. The number of nodes in any
label set is at most 3` + 1, so the width of the decomposition is at most 3`. 2
In particular, any planar graph with diameter D has tree-width O(D).
If an isomorph of a connected pattern H uses vertex v in G, it is contained
in the portion of G within distance |H| of v. By Lemma 4 this |H|-neighborhood
of v has tree-width at most 3|H|. Therefore we can cover G by the collection
of all such neighborhoods, and use Lemma 3 to find the copies of H within
each neighborhood. However such a cover is not efficient: the total size of all
subgraphs is O(n2 ), so this would give us a subgraph isomorphism algorithm
with quadratic runtime. We speed this up to linear by using more efficient
covers.
Awerbuch et al. [3, 5] have introduced the very similar concept of a neigh-
borhood cover, which is a covering of a graph by a collection of subgraphs, with
the properties that the neighborhood of every vertex is contained in some sub-
graph, and that every subgraph has small diameter. They showed that for any
(possibly nonplanar) graph, and any given value w, there is a w-neighborhood
cover in which the diameter of each subgraph is O(w log n), and in which the
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 10
total size of all subgraphs is O(m log n); such a cover can be computed in time
O(m log n + n log2 n) [4]. Because of Lemma 4, such a neighborhood cover is
also almost exactly what we want to speed up our subgraph isomorphism algo-
rithm. However there are two problems. First, the size and construction time
of neighborhood covers are higher than we want (albeit only by polylogarithmic
factors). Second, and more importantly, the diameter of each subgraph is loga-
rithmic, so we are unable to use dynamic programming directly in the subgraphs
of the cover. We would instead be forced to use some additional techniques such
as separator-based divide and conquer, introducing more unwanted logarithmic
factors.
Instead, we use a technique similar to that of Baker [6] to form a cover that
has the properties we want directly: any connected w-vertex subgraph of G is
included in some member of the cover, and each vertex of G is included in few
members of the cover (so the total size of the cover is O(n)). Unlike the tech-
niques cited above, the diameter of the subgraphs will not be bounded, however
we will still be able to use Lemma 4 on an auxiliary graph to show that each
covering subgraph has tree-width O(w). Because of the exponential dependence
of our overall algorithms on the tree-width of the covering subgraphs, we con-
centrate our efforts on reducing this width as much as possible, at the expense
of increasing the total size of the cover by an O(w) factor over the minimum
possible.
S0
S1
S2
S3
S4
S5
S6
S7
S8
S9
S10
Figure 4: Planar graph with breadth first spanning tree (heavy edges), partition
into layers Si , subgraph Gi (for w = 3, i = 5), and minor G0i (with large
supervertex and contracted breadth first spanning tree).
all the vertices with distance at least i + w. G0i is a minor of the planar graph G
and is therefore also planar. Then similarly collapsing a breadth first spanning
tree of G gives a spanning tree of G0i with depth at most w, so G0i has a tree
decomposition with width at most 3w, in which each node of the decomposition
includes the collapsed supervertex in its label. Gi is formed by deleting this
supervertex from G0i , so we can form a tree decomposition of Gi with width at
most 3w − 1 by removing the supervertex from the decomposition of G0i .
Next, we need to show that any connected subgraph H of G with |H| ≤ w
is contained in Gi , where i is the smallest value such that H ∩ Si 6= ∅. But Gi
is formed from G simply by removing the sets Sj where j < i or j ≥ i + w. No
Sj with j < i can contain a vertex of H, or else i would have been smaller. And
no Sj with j ≥ i + w can contain a vertex v of H, or else we could find a path
of length at most i + w − 1 from v0 to v by concatenating a path in H from
some vertex vi ∈ Si ∩ H to v (which has length at most |H| − 1 ≤ w − 1) with
the breadth first tree path from v0 to vi (which has length i), contradicting the
placement of v in Sj . Therefore, none of the vertices that were deleted from G
can belong to H, so H remains a subgraph of Gi .
Finally, the condition that H can not be a subgraph for Gj where j > i is
clearly true, since no such Gj can include any vertex of Si .
The time bound is dominated by the time P to perform theP tree decompositions
on the graphs G0i , which by Lemma 4 is O(wGi ) = wO( Gi ) = w(wn). 2
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 12
7 Further Improvements
For certain patterns, such as the wheels, our results can be further improved
to reduce the time dependence on |H|. Let diam(H) denote the diameter of H
(i.e., the longest distance between any two nodes), and let Kx (H) denote the
maximum number of connected components that can be formed by removing
at most x nodes from H. Note that if the diameter diam(H) is small, we can
use that value instead of |H| in our neighborhood cover of G, reducing the
tree-width of the subgraphs Gi to O(diam(H)).
Proof: The map B can be defined by specifying which (if any) vertex of H
maps to each vertex in L(N ) (using log(|H| + 1) bits per vertex of L(N ) to
specify this information) and also specifying which of the remaining vertices in
H map to the vertex x in G0N and which ones map to the vertex y. However, it
is not possible for the boundary to come from an actual subgraph isomorphism
unless each connected component of H \ B −1 (L(N )) is mapped consistently
either to x or to y, since any path from x to y must pass through a vertex of
L(N ). So, to finish specifying the boundary, we need only add this single bit of
information per component of H \ B −1 (L(N )), and by definition there are at
most K|L(N)| (H) such components. 2
As a consequence, the analysis in Lemma 2 can be tightened to show that
the dynamic program takes time 2O(KO(diam(H)) (H)+diam(H) log |H|) n.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 14
Proof: For Hamiltonian graphs and bounded degree graphs this is straightfor-
ward. For 3-connected graphs, assume without loss of generality that no edge
can be added to H connecting two vertices in S; then each component of H − S
must occupy a distinct face in the planar embedding of S induced by the unique
embedding of H. 2
Proof: The proof consists simply of plugging the improved analysis of Lemma 6
into the algorithm of Theorem 1. 2
For instance we can count the isomorphs of a wheel Wk in a planar text
graph G with n vertices, in time O(nk O(1) ). In fact in this case it is not difficult
to come up with an O(nk 2 ) algorithm:
Proof: For each vertex v, we count the number of cycles of length k in the
neighbors of v. The sum of the sizes of all neighborhoods in G is O(n). Each
neighborhood has treewidth at most 2 by Lemma 4. Any partial isomorphism
of a k-cycle in a node N of this decomposition can only consist of a single path
of at most k − 1 vertices, which starts and ends at some two of the at most
three vertices in L(N ) and may or may not involve the third vertex; therefore
we need only keep track of O(k) different partial isomorph boundaries at each
node. A careful analysis of the steps in the algorithm of Lemma 2 then shows
that the most expensive step (finding compatible triples) can be performed in
time O(k 2 ) per node, giving an overall running time of O(k 2 n). 2
Theorem 5 We can find the girth g of any planar graph G, or find a small-
est nonfacial cycle C for an embedded planar graph, in time 2O(g log g) n or
2O(|C| log |C|) n respectively.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 15
Proof: We describe how to test for the existence of a separating cycle of length
i; the shortest such cycle can then be found by a sequential search similar to
the computation of the girth.
We first modify the construction of the graphs Gi in Lemma 5, by including
in Gi not only all the vertices in layers Si through Si+w−1 but also a single
supervertex for each connected component of the graph induced by the vertices
in layers Sj , j ≥ i + w, and a supervertex for the (single) connected component
of the vertices in layers Sj , j < i. Then a cycle that uses only vertices in layers
Si through Si+w−1 (and does not use any of the supervertices) is separating in
the modified Gi if and only if the corresponding cycle is separating in G. Note
that the added supervertices only add one level to the breadth first search tree
of Gi and hence the tree-width is still O(w).
Then we need merely modify the dynamic program of Lemma 2, to use a
definition of a partial isomorph boundary that, in addition to the map B :
H 7→ G0N , specifies which of the remaining unmapped vertices of G0N are in
each of the two subsets of G separated by the cycle, enforcing the requirement
that no vertex in one subset be adjacent to a vertex in the other subset. This
modification multiplies the number of boundaries by 2O(w) , but this increase is
swamped by the 2O(w log w ) terms from our previous analysis. 2
We next consider the application of our techniques to certain graph clustering
problems.
Definition 2 (Keil and Brecht [30]) The h-clustering problem is that of ap-
proximating the maximum clique by finding a set of h vertices inducing as many
edges as possible. The connected h-clustering problem adds the restriction that
the induced subgraph be connected.
Keil and Brecht [30] study these problems, and show that even though cliques
are easy to find in planar graphs [40], the connected h-clustering problem is NP-
complete for planar graphs. See [32] for approximate h-clustering algorithms in
general graphs.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 16
Theorem 7 For any h we can solve the planar h-clustering and connected h-
clustering problems in time 2O(h log h) n.
Proof: We simply to test subgraph isomorphism for all possible planar graphs
on h vertices, and return the subgraph isomorph with the most edges. 2
We now describe two applications to connectivity that, unlike the previ-
ous applications, are linear without an exponential dependence on a separate
parameter.
The vertex connectivity of G is the minimum number of vertices such that
their deletion leaves a disconnected subgraph. Since every planar graph has a
vertex of degree at most five, the vertex connectivity is at most five. We now
use a method of Nishizeki (personal communication) to transform the vertex
connectivity problem into one of finding short cycles, similar to those discussed
at the start of this section. We choose some plane embedding of G, and construct
a new graph G0 having n + f vertices: the n original vertices of G and f new
face-vertices corresponding to the faces of G. We place an edge in G0 between an
original vertex and a face-vertex whenever the corresponding vertex and face are
incident in G. Then G0 is a bipartite plane-embedded graph. This construction
is illustrated in the center of Figure 5.
Lemma 8 Any minimal set S ⊂ G of vertices the deletion of which would
disconnect G corresponds to a cycle C ⊂ G0 of the same original vertices and
an equal number of face-vertices in G0 , such that G0 \C has at least two connected
components each containing at least one original vertex. Conversely if C is any
cycle such that G0 \ C has at least two connected components each containing at
least one original vertex, then the original vertices in C form a cutset in G.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 17
Theorem 11 Given a planar graph G, and any value `, we can in time and
space O(`n log n) build a data structure that can, given a query pair of vertices,
either return the distance between the pair or determine that the distance is
greater than `, in time O(`) per query.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 19
Theorem 12 Given a planar graph G, and any value `, we can build a data
structure of size O(`n) that can, given a query pair of vertices, either return the
distance between the pair or determine that the distance is greater than `, in
time O(`2 log n) per query.
Our data structure then consists of the matrix of distances from vertices in
L(N1 ) to vertices in L(N2 ), for each pair N 1, N 2 of related nodes. The space
for this data structure is O(n`). It can either be built as a subset of the data
structure of Theorem 11, in time O(n` log n), or bottom-up (using hierarchical
clustering techniques of Frederickson [22] to construct the level structure in
T , and then computing each distance matrix from two previously-computed
distance matrices in time O(`3 )) in total time O(n`2 ); we omit the details.
To answer a query, we form chains of related pairs connecting the home
nodes (or small subtrees) of the query vertices to their common ancestor in T 0 .
The levels of the nodes in these two chains becomes earlier at each step towards
the common ancestor, so the total number of pairs in the chain is O(log n). We
then build a graph, in which we include an edge between each pair of vertices
in the labels of a related pair of nodes, labeled with the distance stored in the
matrix for that pair. We also include in that graph the edges of G belonging to
the small subtrees containing the query vertices, if they belong to small subtrees.
The query can then be answered by finding a shortest path in this graph, which
has O(` log n + `2 ) vertices and O(`2 log n) edges. 2
The following theorem on computing diameter improves the naive O(n2 )
bound for all pairs shortest paths when the diameter is small. Note that diam-
eter is not a subgraph isomorphism problem but it succumbs to similar tech-
niques.
Figure 6: The graph on the left is an apex graph; the topmost vertex is one of
the possible choices for its apex. The graph on the right is not an apex graph.
Definition 4 An apex graph is a graph G such that for some vertex v (the
apex), G \ {v} is planar (Figure 6).
Note that the bound on tree-width from Theorem 14 is much higher than
the linear bound in Lemma 4, so the dependence on |H| of the time bound of
the algorithm implied by Corollary 1 is much greater than in our planar graph
algorithms. However, for certain important minor-closed graph families (such as
bounded genus graphs) we were able to prove a better dependence of tree-width
on diameter [15], leading to less impractical algorithms.
• We have shown that we can solve planar subgraph isomorphism even for
disconnected patterns in time O(n). Can we list all occurrences of a
disconnected pattern in time O(n + k)?
• Bui and Peck [11] describe an algorithm for finding the smallest set of
edges partitioning a planar graph into two sets of vertices with specified
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 23
sizes; if the edge set has bounded size their algorithm has cubic running
time. Can we use our methods to find such a partition more quickly?
• It seems possible that the recently discovered randomized coloring tech-
nique of Alon et al. [1] can improve the dependence on the size of the
pattern from 2O(w log w) to 2O(w) , but only for the decision problem of sub-
graph isomorphism. Can we achieve similar improvements for the counting
and listing versions of the subgraph isomorphism problem?
Acknowledgements
The author wishes to thank Sandy Irani, George Lueker, and the anonymous
referees, for helpful comments on drafts of this paper.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 24
References
[1] N. Alon, R. Yuster, and U. Zwick. Color-coding. J. Assoc. Comput. Mach.
42(4):844–856, July 1995.
[2] P. J. Artymiuk, P. A. Bath, H. M. Grindley, C. A. Pepperrell, A. R. Poir-
rette, D. W. Rice, D. A. Thorner, D. J. Wild, P. Willett, F. H. Allen, and
R. Taylor. Similarity searching in databases of three-dimensional molecules
and macromolecules. J. Chemical Information and Computer Sciences
32:617–630, 1992.
[3] B. Awerbuch, B. Berger, L. Cowen, and D. Peleg. Low-diameter graph
decomposition is in NC. 3rd Scand. Worksh. Algorithm Theory (SWAT),
vol. 621, pp. 83–93. Springer-Verlag Lecture Notes in Computer Science,
1992.
[4] B. Awerbuch, B. Berger, L. Cowen, and D. Peleg. Near-linear time con-
struction of sparse neighborhood covers. SIAM J. Computing 28(1):263–
277, 1998.
[5] B. Awerbuch and D. Peleg. Sparse partitions. Proc. 31st IEEE Symp.
Foundations of Computer Science, pp. 503–513, 1990.
[6] B. S. Baker. Approximation algorithms for NP-complete problems on pla-
nar graphs. J. Assoc. Comput. Mach. 41:153–180, 1994.
[7] R. Bar-Yehuda and S. Even. On approximating a vertex cover for pla-
nar graphs. Proc. 14th Symp. Theory of Computing, pp. 303–309. Assoc.
Comput. Mach., 1982.
[8] D. Bayer and D. Eisenbud. Graph curves. Advances in Math. 86:1–40,
1991.
[9] M. W. Bern, E. L. Lawler, and A. L. Wong. Linear-time computation of
optimal subgraphs of decomposable graphs. J. Algorithms 8:216–235, 1987.
[10] A. D. Brown and P. R. Thomas. Goal-oriented subgraph isomorphism
technique for IC device recognition. IEE Proceedings I (Solid-State and
Electron Devices) 135:141–150, 1988.
[11] T. N. Bui and A. Peck. Partitioning planar graphs. SIAM J. Computing
21:203–215, 1992.
[12] N. Chiba and T. Nishizeki. Arboricity and subgraph listing algorithms.
SIAM J. Computing 14:210–223, 1985.
[13] M. Chrobak and D. Eppstein. Planar orientations with low out-degree and
compaction of adjacency matrices. Theoretical Computer Science 86:243–
266, 1991.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 25
[41] J. Plehn and B. Voigt. Finding minimally weighted subgraphs. Proc. 16th
Int. Worksh. Graph-Theoretic Concepts in Computer Science, pp. 18–29.
Springer-Verlag, Lecture Notes in Computer Science 484, 1991.
[42] D. Richards. Finding short cycles in planar graphs using separators. J.
Algorithms 7:382–394, 1986.
[43] N. Robertson and P. D. Seymour. Graph Structure Theory: Proc. Joint
Summer Res. Conf. Graph Minors. Contemporary Mathematics 147. Amer.
Math. Soc., 1991.
[44] T. Stahs and F. M. Wahl. Recognition of polyhedral objects under per-
spective views. Computers and Artificial Intelligence 11:155–172, 1992.
[45] M. M. Syslo. The subgraph isomorphism problem for outerplanar graphs.
Theoretical Computer Science 17:91–97, 1982.
[46] K. Takamizawa, T. Nishizeki, and N. Saito. Linear-time computability of
combinatorial problems on series-parallel graphs. J. Assoc. Comput. Mach.
29:623–641, 1982.
[47] G. Turán. On the succinct representation of graphs. Discrete Applied
Mathematics 8(3):289–294, 1984.
Journal of Graph Algorithms and Applications
http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 4, pp. 1-2 (1999)
Petra Mutzel
Institut für Computergraphik
Technische Universität Wien
Karlsplatz 13/186, 1040 Wien, Austria
mutzel@apm.tuwien.ac.at
Di Battista and Mutzel, Guest Editors’ Introduction, JGAA, 3(4) 1-2 (1999) 2
This Special Issue is devoted to selected papers from the 1997 Symposium
on Graph Drawing, held in Rome, Italy, on September 18–20, 1997. The Graph
Drawing field is a continual source of interesting problems and general method-
ologies that have both theoretical depth and impact on real-life applications.
Among the “hot” topics in the area, we consider the following especially intrigu-
ing: (i) drawing large graphs by means of clustering techniques, (ii) visualizing
graphs in 3D, and (iii) finding linear-time solutions to problems usually tackled
by computationally expensive flow techniques. These topics are addressed in
the collection of selected papers of this Special Issue.
Drawing large graphs is important for several applications. A promising
approach to the problem is the one of grouping the vertices and the edges into
clusters and of allowing the user to visualize the graph selecting her/his favorite
“abstraction level”. In the selected level, some clusters will be collapsed into
single vertices, while some other clusters will be explicitly drawn, with the
constraint that the vertices belonging to the same cluster are placed close to
each other. Eades, Feng, and Nagamochi propose an algorithm for efficiently
constructing clustered drawings with several guarantees on the aesthetic quality
of the result.
The problem of constructing orthogonal drawings of plane graphs with the
minimum number of bends is usually tackled in terms of a flow problem. Such
a method yields algorithms whose time complexity is nonlinear in the number
of vertices. Rahman, Nakano, and Nishizeki propose an innovative method that
allows to produce in linear time optimal orthogonal drawings for a fairly large
class of plane graphs.
Research in 3D graph drawing is attracting increasing attention. In fact,
low-price high-performance 3D graphic workstations are becoming widely avail-
able. Also, 3D graph drawing offers interesting perspectives to the sophisticated
demand of visualization coming from new graphical user interfaces. The paper
by Biedl, Shermer, Whitesides, and Wismath studies 3D drawings of graphs
with vertices represented by boxes. It proposes new construction methods and
offers bounds that can become reference points in the field. The paper by Pa-
pakostas and Tollis is based on a realistic interactive setting, where vertices
arrive and enter the drawing on-line. The presented algorithms have very good
behavior in terms of the volume occupied by the drawing and of the number of
bends along the edges.
Finally, we wish to thank all the referees. They gave a fundamental contri-
bution to the preparation of this Special Issue.
Journal of Graph Algorithms and Applications
http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 4, pp. 3–29 (1999)
Qingwen Feng
Tom Sawyer Software
http://www.tomsawyer.com/
Hiroshi Nagamochi
Department of Applied Mathematics and Physics
Kyoto University
http://www.kyoto-u.ac.jp/
Abstract
Clustered graphs are graphs with recursive clustering structures over
the vertices. For graphical representation, the clustering structure is rep-
resented by a simple region that contains the drawing of all the vertices
which belong to that cluster. In this paper, we present an algorithm which
produces planar drawings of clustered graphs in a convention known as
orthogonal grid rectangular cluster drawings. If the input graph has n
vertices, then the algorithm produces in O(n) time a drawing with O(n2 )
area and at most 3 bends in each edge. This result is as good as existing
results for classical planar graphs. Further, we show that our algorithm
is optimal in terms of the number of bends per edge.
Communicated by Giuseppe Di Battista and Petra Mutzel.
Submitted: May 1998. Revised: December 1998 and April 1999.
This work was supported by a research grant from the Australian Research Council
and a grant from the Kyoto University Foundation. The work was partially car-
ried out while the second and third authors were visiting the University of Newcas-
tle. Authors’ email addresses: eades@cs.newcastle.edu.au, wfeng@tomsawyer.com,
naga@kuamp.kyoto-u.ac.jp.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 4
1 Introduction
Graphs are commonly used to model relational information in computing. Many
software systems need a graph drawing function. Examples include CASE
tools [50], management information systems [22], software visualization tools [49],
and VLSI design tools [20]. Graph drawing algorithms aim to produce drawings
which are easy to read and easy to remember. Many graph drawing algorithms
have been designed, analyzed, tested and used in visualization systems [7].
With increasing complexity of the information that we want to visualize,
more structures are needed on top of the classical graph model. Clustered
graphs are graphs with recursive clustering structures (see Figure 1). This type
of clustering structure appears in many structured diagrams [20, 26, 28, 38].
Drawing algorithms for clustered graphs are difficult. Heuristic methods for
drawing similar structures have been developed by Sugiyama and Misue [30, 39],
North [31], and by Madden et al. [25]. Algorithms for constructing straight-line
drawings of clustered graphs are given in [9, 10, 15]; note, however, that straight-
line drawings of clustered graphs can require exponential area [15].
In this paper, we present a linear time algorithm which produces planar
drawings of clustered graphs in a convention called “orthogonal grid rectangu-
lar cluster drawings”. We apply a technique to order the clusters of the graph
recursively, and we use a “visibility representation” for directed graphs to pro-
duce our drawings.
Queensland
Victoria Brisbane QUT
Melbourne
LaTrobe
NSW UNE
Monash SU UNSW
8 7
6
7 6 5
5 4
3 4 3
2
2
1
1
(a) (b)
edge (if n > 6), and the total number of bends is no more than d3n/2e + 4.
If the graph is connected with degree at most 3, then the algorithm draws on
an bn/2c × bn/2c grid with at most 2 bends in each edge and no more than
bn/2c + 1 bends in total. Even and Granot [11] have presented an algorithm
such that for any planar graph with degree at most 4, the drawing has O(n2 )
area, and there are at most 3 bends in each edge. Lower bounds on the area
and the number of bends for planar orthogonal drawings of graphs have been
presented by Tamassia, Tollis and Vitter [46], and by Biedl [4].
Another useful representation for planar graphs is the visibility representa-
tion [36, 43]. Figure 2 shows a planar graph and a visibility representation of
the graph. Visibility representation is related to orthogonal drawing in that it is
often used as a basis for constructing an orthogonal drawing. Several orthogonal
drawing algorithms [11, 44, 45] first construct a visibility representation of the
graph, then transform it to an orthogonal drawing.
In Section 3, we present an algorithm for planar drawing of clustered graphs
using the same approach. Given an n vertex clustered graph of maximum degree
4, our algorithm produces in O(n) time an orthogonal grid rectangular cluster
drawing with O(n2 ) area and with at most 3 bends in each edge. This result is
as good as the results for classical planar graphs [11, 24, 45]. Further, Section
4 presents a class of graphs each of which has a set of Ω(n) edges each of which
require at least 3 bends; thus there is no algorithm that can improve on the
worst case performance of our algorithm with respect to the number of bends
per edge. A byproduct of our method is a visibility algorithm for clustered
graphs; given an n vertex clustered graph (with no limit on the degree), the
algorithm produces a visibility representation where the clusters are represented
by rectangles. A clustered graph, together with the visibility representation
and orthogonal drawing produced by our algorithm, is in Figure 3. Section 5
concludes with some extensions of our work and some open problems.
2 Terminology
A clustered graph C = (G, T ) consists of an undirected graph G = (V, A) and a
rooted tree T = (V, A) such that the leaves of T are exactly the vertices of G.
For a node ν in T , let chl(ν) denote the set of children of ν, and pa(ν) denote
the parent of ν (if ν is not the root). Each node ν of T represents a cluster V (ν)
of the vertices of G that are leaves of the subtree rooted at ν. The subgraph of
G induced by V (ν) is denoted by G(ν). Note that tree T describes an inclusion
relation between clusters. If a node ν 0 is a descendant of a node ν in the tree
T , then we say the cluster of ν 0 is a sub-cluster of ν.
In a drawing of a clustered graph C = (G, T ), graph G is drawn as points
and curves as usual. For each node ν of T , the cluster is drawn as simple closed
region R that contains the drawing of G(ν), such that:
(1) the regions for all sub-clusters of ν are completely contained in the interior
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 7
of R;
(2) the regions for all other clusters are completely contained in the exterior
of R;
(3) if there is an edge e between two vertices of V (ν) then the drawing of e is
completely contained in R.
We say that the drawing of edge e and region R have an edge-region crossing
00111100
000
111 0110
000
111
0011 00111100 1010
000
111 10
000
111
1100
11001100 1100 1100
1100
111
000 0011
00111100
(a)
(b)
00111100 111
000
0011
00111100
000
111
11001100
00 111
110011001100 000
00111100
0011
(c)
Figure 3: (a) A clustered graph, (b) The visibility representation output by our
algorithm, and (c) The orthogonal drawing output by our algorithm.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 8
(2) orthogonalization;
(3) bend reduction.
It is clear that OGRC drawings are restricted to clustered graphs in which each
vertex of G has degree at most 4 in G; however, the visibility representation
(phase 1) can be constructed for any c-planar clustered graph. We treat the
three phases in turn.
number assigned to more than one vertex, as long as it does not violate the
property that a vertex u(6= s, t) is adjacent to two neighbors v and w such that
λ(v) < λ(u) < λ(w).
Proof: The algorithm for obtaining a c-st numbering is complex and given fully
in [9, 10]; here we briefly sketch the main thrust of the algorithm.
For a cluster ν ∈ V, let G∗ (ν) be the (classical) graph obtained from G(ν) by
shrinking each child cluster V (ν 0 ), for each ν 0 ∈ chl(ν), to a single vertex. An st
numbering of G∗(ρ), where ρ is the root of the cluster tree T , can be computed in
linear time using the algorithm of Even and Tarjan [13]. Now suppose that ν is a
child of the root. In this case, we need to augment G∗(ν) (with vertices and edges
from G∗ (ρ), ρ ∈ chl(ν)) and apply the algorithm recursively to the augmented
graph. Using the order of the children ν of ρ given by the st numbering of G∗(ρ),
together with the c-st numberings of each V (ν) provided by recursion, one can
obtain a c-st numbering of the complete clustered graph. 2
With this c-st numbering, we transform a clustered graph into a planar
st-graph by applying directions for edges of G according to the c-st numbering.
t*
s*
Figure 4: Extending G to G∗ .
total number of them is linear. The main difficulty is ensuring that the time
required to identify the edges is linear; the remainder of this subsection presents
the algorithm for this.
Note that for each node ν in T , L− (ν) and L+ (ν) are contained in the same
facial triangle in G∗ , since G∗ is triangulated. Similarly, R− (ν) and R+ (ν) are
in the same facial triangle in G∗ . A facial triangle which contains L− (ν) and
L+ (ν) (or R− (ν) and R+ (ν)) for a cluster ν is a support triangle of ν. Any
node ν in T has exactly two support triangles (one on its left, and one on its
right), where the added edges incident to s∗ or t∗ ensure the existence of support
triangles of the root cluster of G. The support triangles are used to compute the
edges L− (ν), L+ (ν), R− (ν) and R+ (ν) for all nodes ν in T . Firstly, however,
we must show how to compute the support triangles.
Let c(u, v) denote the least common ancestor of two nodes u and v in T . After
O(n) time preprocessing, c(u, v) can be found in O(1) time [21, 37]. Suppose
that τ = (u1 , u2 , u3) is a facial triangle with directed edges e1 = (u1 , u2 ), e2 =
(u2 , u3 ) and e3 = (u1 , u3). If ν is a cluster such that u2 ∈ V (ν) and {u1 , u3 } ∩
V (ν) = ∅ then τ is a support triangle of ν; see Figure 5(a). It is easy to
see that τ is a support triangle for all clusters ν on the path from u2 to µ =
min{c(u1 , u2 ), c(u2 , u3 )} in T , where the minimum means to take the lower node
in T among the two; see Figure 5(b). Thus the following algorithm can be used
to identify the support triangles of each cluster:
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 13
root
T
µ
u3 e2
u2
e3 τ
e1 cluster ν
u1 u1 u3
u2
(a) (b)
For each cluster ν, we add four dummy vertices `d(ν), `u(ν), rd(ν) and ru(ν),
then add six new edges (see Figure 6):
(tail(L− (ν)), `d(ν)),
(`d(ν), `u(ν)),
(`u(ν), head(L+ (ν))),
(tail(R− (ν)), rd(ν)),
(rd(ν), ru(ν)) and
(ru(ν), head(R+(ν))).
The pairs (`d(ν), `u(ν)), (rd(ν), ru(ν)), (`d(ν), rd(ν)) and (`u(ν), ru(ν)) rep-
resent the four sides of a rectangle for ν in the final drawing of the clustered
graph. In T we place these dummy vertices as children of ν which will be new
leaves.
L+ ( ν ) R +( ν )
lu ( ν ) ru ( ν )
G (ν ) G (ν )
ld ( ν ) rd ( ν )
L- ( ν ) R- ( ν)
G( ν) G( ν)
v v
3.2 Orthogonalization
For this phase, we assume that the input has maximum degree 4. Note that the
process of adding dummy vertices and edges does not increase the maximum
degree. To transform the visibility representation to an OGRC drawing, we only
need to perform some local operations at each vertex, transforming a horizontal
segment to a point. These local operations are illustrated in Figure 10; symmet-
ric cases for (a), (c), (d), (e) and (f) are omitted for brevity. Note that Figure 10
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 18
covers all the cases that can appear, since we have required that certain edges
around a vertex are aligned. Further, note that a new row is added at every
source or sink of degree 4 (see Figure 10(h) and (i)). The number of rows and
columns becomes at most twice in in the resulting OGRC drawing.
(d) (e)
(f) (g)
(h) (i)
v v
e e
u u
A
a1 a2 a3 a4 a5 a6 a7
b1 b2 b3 b4
1 2 3 4 5 6 7 8 9 10
5 Remarks
In this paper, we present a linear time algorithm Orthogonal Grid Rectangular Draw
that produces c-planar OGRC drawings with O(n2 ) area and with at most 3
bends in each edge. These results are as good as the results for classical pla-
nar graphs [11, 24, 45]. Lower bounds for the area of orthogonal drawings of
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 23
An
a1 a7
b1 b4
Bn
n copies of I.
classical graphs [48] imply that the area of the drawing produced by our algo-
rithm is asymptotically optimal. Further, we show that the performance of our
algorithm is optimal in terms of the number of bends per edge.
Nevertheless, some open problems remain:
• Although the height and the width of our output drawings are both O(n),
our algorithm does not guarantee a good aspect ratio. In practice, our al-
gorithm may produce drawings which clearly prefer one dimension against
the other; this is because we use a visibility representation which is biased
to one dimension. As an example, note that Figure 1 could not be pro-
duced by our algorithm as it is. Recent investigations of “2-dimensional
visibility representations” [6, 17] of planar graphs (each vertex is repre-
sented by a box and each edge is represented by a horizontal or vertical
segment between the sides of the boxes) may prove useful in terms of the
aspect ratio of the drawing.
• Even and Granot [12] have presented some algorithms for grid layout of
block diagrams. Although the drawing requirements there are different
from the requirements of drawing clustered graphs, it would be worthwhile
to investigate whether we can borrow some of the techniques there and
for use in drawing clustered graphs.
• In recent years, many results have been achieved for orthogonal drawings
of non planar graphs [5, 4, 33, 34]. It seems very profitable to use these
results to extend our algorithm to non planar clustered graphs.
• This paper deals only with graphs of degree at most four. In practice,
algorithms must deal with higher degree vertices. Our methods can be
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 24
(ii) the convex polygon for a cluster ν is the convex hull of points in V (ν).
The drawing can be obtained in O(n + D) time, where D denotes the total size
of convex polygons for clusters.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 25
Acknowledgments
The authors wish to thank the referees for several useful suggestions.
References
[1] C. Batini, L. Furlani, and E. Nardelli. What is a good diagram? a prag-
matic approach. In Proc. 4th Int. Conf. on the Entity Relationship Ap-
proach, 1985.
[2] G. Di Battista and R. Tamassia. Algorithms for plane representations of
acyclic digraphs. Theoretical Computer Science, 61:175–198, 1988.
[3] G. Di Battista, R. Tamassia, and I.G. Tollis. Constrained visibility repre-
sentations of graphs. Information Processing Letters, 41:1–7, 1992.
[4] T. Biedl. New lower bounds for orthogonal graph drawings. In Franz J.
Brandenburg, editor, GD’95, volume 1027 of Lecture Notes in Computer
Science, pages 28–39. Springer-Verlag, 1995.
[5] T. Biedl and G. Kant. A better heuristic for orthogonal graph drawings.
Comput. Geom. Theory Appl., 9:159–180, 1998.
[6] P. Bose, A. Dean, J. Hutchinson., and T. Shermer. On rectangle visibility
graphs. In Stephen C. North, editor, GD’96, volume 1190 of Lecture Notes
in Computer Science, pages 25–44. Springer-Verlag, 1997.
[7] G. Di Battista, P. Eades, R. Tamassia, and I. G. Tollis. Graph Drawing.
Prentice Hall, Upper Saddle River, NJ, 1999.
[8] Michael Doorley. Automatic Leveling and Layout of Data Flow Diagrams.
PhD thesis, Department of Computer Science and Information Sys tems,
University of Limerick, Ireland, August 1995.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 26
[9] P. Eades, Q-W. Feng, and X. Lin. Straight-line drawing algorithms for hier-
archical graphs and clustered graphs. Technical Report 96-02, Department
of Computer Science, The University of Newcastle, Australia, 1996.
[10] P. Eades, Q-W. Feng, X. Lin, and H. Nagamochi. Straight-line drawing
algorithms for hierarchical graphs and clustered graphs. Technical Report
98-03, Department of Computer Science, The University of Newcastle, Aus-
tralia, 1998.
[11] S. Even and G. Granot. Rectilinear planar drawings with few bends in
each edge. Technical Report 797, Computer Science Department, Technion,
Israel Institute of Technology, 1994.
[12] S. Even and G. Granot. Grid layout of block diagrams - bounding the
number of bends in each connection. In R. Tamassia and I. G. Tollis,
editors, GD’94, volume 894 of Lecture Notes in Computer Science, pages
64–75. Springer-Verlag, 1995.
[13] S. Even and R. E. Tarjan. Computing an st-numbering. Theoretical Com-
puter Science, 2:339–344, 1976.
[14] Q. Feng. Algorithms for Drawing Clustered Graphs. PhD thesis, Depart-
ment of Computer Science and Software Engineering, University of New-
castle, 1997.
[15] Q. Feng, R. Cohen, and P. Eades. How to draw a planar clustered graph.
In COCOON’95, volume 959 of Lecture Notes in Computer Science, pages
21–31. Springer-Verlag, 1995.
[16] Q. Feng, R. Cohen, and P. Eades. Planarity for clustered graphs. In
ESA’95, volume 979 of Lecture Notes in Computer Science, pages 213–226.
Springer-Verlag, 1995.
[17] U. Fößmeier, G. Kant, and M. Kaufmann. 2-visibility drawings of planar
graphs. In Stephen C. North, editor, GD’96, volume 1190 of Lecture Notes
in Computer Science, pages 155–168. Springer-Verlag, 1997.
[18] U. Fößmeier and M. Kaufmann. Drawing high degree graphs with low bend
numbers. In Franz J. Brandenburg, editor, GD’95, volume 1027 of Lecture
Notes in Computer Science, pages 254–266. Springer-Verlag, 1995.
[19] A. Garg and R. Tamassia. On the computational complexity of upward
and rectilinear planarity testing. In R. Tamassia and I. G. Tollis, editors,
GD’94, volume 894 of Lecture Notes in Computer Science, pages 286–297.
Springer-Verlag, 1995.
[20] D. Harel. On visual formalisms. Communications of the ACM, 31(5):514–
530, 1988.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 27
[21] D. Harel and R. Tarjan. Fast algorithms for finding nearest common an-
cestors. SIAM J. Computing, 13:338 – 355, 1984.
[22] T. Kamada. Visualizing Abstract Objects and Relations. World Scientific
Series in Computer Science, 1989.
[23] G. Kant. Drawing planar graphs using the lmc-ordering. In Proc. 33th
IEEE Symp. on Foundations of Computer Science, pages 101–110, 1992.
[24] G. Kant. Drawing planar graphs using the canonical ordering. Algorithmica,
16:4–32, 1996.
[25] G. Kar, B.P. Madden, and R.S. Gilbert. Heuristic layout algorithms for
network management presentation services. IEEE Network, pages 29–36,
November 1988.
[26] J. Kawakita. The KJ method – a scientific approach to problem solving.
Technical report, Kawakita Research Institute, Tokyo, 1975.
[27] M.R. Kramer and J. van Leeuwen. The complexity of wire-routing and find-
ing minimum area layouts for arbitrary VLSI circuits. In F.P. Preparata,
editor, Advances in Computing Research, volume 2, pages 129–146. JAI
Press, Greenwich, Conn., 1985.
[28] W. Lai. Building Interactive Digram Applications. PhD thesis, Department
of Computer Science, University of Newcastle, 1993.
[29] C. E. Leiserson. Area-efficient graph layouts (for VLSI). In Proceedings of
the IEEE Symposium on the Foundations of Computer Science, pages 270
– 281, 1980.
[30] K. Misue and K. Sugiyama. An overview of diagram based idea organizer:
D-abductor. Technical Report IIAS-RR-93-3E, ISIS, Fujitsu Laboratories,
1993.
[31] S. North. Drawing ranked digraphs with recursive clusters. In Proc. AL-
COM Workshop on Graph Drawing ’93, September 1993.
[32] J. Nummenmaa and J. Tuomi. Constructing layouts for er-diagrams from
visibility representations. In Proc. 9th Int. Conf. on Entity-Relationship
Approach, pages 303–317, 1990.
[33] A. Papakostas and I. G. Tollis. Improved algorithms and bounds for or-
thogonal drawings. In R. Tamassia and I. G. Tollis, editors, GD’94, volume
894 of Lecture Notes in Computer Science, pages 40–51. Springer-Verlag,
1994.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 28
[45] R. Tamassia and I.G. Tollis. Planar grid embedding in linear time. IEEE
Trans. on Circuits and Systems, CAS-36(9):1230–1234, 1989.
[46] R. Tamassia, I.G. Tollis, and J.S. Vitter. Lower bounds for planar orthog-
onal drawings of graphs. Information Processing Letters, 39:35–40, 1991.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 29
Abstract
An orthogonal drawing of a plane graph G is a drawing of G in which
each edge is drawn as a sequence of alternate horizontal and vertical line
segments. In this paper we give a linear-time algorithm to find an or-
thogonal drawing of a given 3-connected cubic plane graph with the min-
imum number
√ of bends. The best previously known algorithm takes time
O(n7/4 log n) for any plane graph with n vertices.
1 Introduction
An orthogonal drawing of a plane graph G is a drawing of G with the given
embedding in which each vertex is mapped to a point, each edge is drawn
as a sequence of alternate horizontal and vertical line segments, and any two
edges do not cross except at their common end. Orthogonal drawings have
attracted much attention due to their numerous practical applications in circuit
schematics, data flow diagrams, entity relationship diagrams, etc. [1, 5, 9, 10,
11]. In particular, we wish to find an orthogonal drawing with the minimum
number of bends. For the plane graph in Fig. 1(a), the orthogonal drawing in
Fig. 1(b) has the minimum number of bends, that is, seven bends.
For a given planar graph G with n vertices, if one is allowed to choose its
planar embedding, then finding an orthogonal drawing of G with the minimum
number of bends is NP-complete [3]. However, Tamassia [10] and Garg and
Tamassia [4] presented algorithms that compute an orthogonal drawing of a
given plane
√ graph G with the minimum number of bends in O(n2 log n) and
7/4
O(n log n) time respectively, where a plane graph is a planar graph with a
fixed planar embedding. They reduce the minimum-bend orthogonal drawing
problem to a minimum cost flow problem. On the other hand, several linear-time
algorithms are known for finding orthogonal drawings of plane graphs with a
presumably small number of bends although they do not always find orthogonal
drawings with the minimum number of bends [1, 5].
In this paper we give a linear-time algorithm to find an orthogonal drawing
of a 3-connected cubic plane graph with the minimum number of bends. To the
best of our knowledge, our algorithm is the first linear-time algorithm to find an
orthogonal drawing with the minimum number of bends for a fairly large class
of graphs.
An orthogonal drawing in which there is no bend and each face is drawn as
a rectangle is called a rectangular drawing. Linear-time algorithms have been
known to find a rectangular drawing of a plane graph in which every vertex
has degree three except four vertices of degree two on the outer boundary,
whenever such a graph has a rectangular drawing [6, 8]. The key idea behind
our algorithm is to reduce the orthogonal drawing problem to the rectangular
drawing problem.
An outline of our algorithm is illustrated in Fig. 1. Given a plane graph as
shown in Fig. 1(a), we first put four dummy vertices a, b, c and d of degree two on
the outer boundary of G, and let G0 be the resulting graph. Fig. 1(c) illustrates
G0 , where the four dummy vertices are drawn by white circles. We then contract
each of some cycles C1 , C2 , · · · and their interiors (shaded in Fig. 1(c)) into
a single vertex as shown in Fig. 1(d) so that the resulting graph G00 has a
rectangular drawing as shown in Fig. 1(e). We also find orthogonal drawings of
those cycles C1 , C2 , · · · and their interiors recursively (see Figs. 1(d) and (e)).
Patching the obtained drawings, we get an orthogonal drawing of G0 as shown
in Fig. 1(f). Replacing the dummy vertices a, b, c and d in the drawing of G0
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 33
b a b
a
c
d c
G
d
G
(a) (b)
y1
b z1
y
b 1 z1
C1
x1
a C1
z2
G
C2 a x1
c
c z2
x2
y2 x2
y
2
C2
d G
dummy vertex d
contracted vertex
(c) (d)
a b
y
1
a b z1 y
y z2 1
x1 2
C1 z
y x1 1
2 z2
d c
x2
G
C 2 x2 c
d
G
(e) (f)
2 Preliminaries
In this section we give some definitions and present preliminary results.
Let G be a connected simple graph with n vertices and m edges. We denote
the set of vertices of G by V (G), and the set of edges of G by E(G). We also
denote by n(G) the number of vertices in G and by m(G) the number of edges
in G. Thus n(G) = |V (G)| and m(G) = |E(G)|. The degree of a vertex v is
the number of neighbors of v in G. If every vertex of G has degree three, then
G is called a cubic graph. The connectivity κ(G) of a graph G is the minimum
number of vertices whose removal results in a disconnected graph or a single-
vertex graph K1 . We say that G is k-connected if κ(G) ≥ k.
A graph is planar if it can be embedded in the plane so that no two edges
intersect geometrically except at a vertex to which they are both incident. A
plane graph is a planar graph with a fixed embedding. A plane graph divides
the plane into connected regions called faces. We regard the contour of a face as
a clockwise cycle formed by the edges on the boundary of the face. We denote
the contour of the outer face of graph G by Co (G).
For a simple cycle C in a plane graph G, we denote by G(C) the plane
subgraph of G inside C (including C). We say that cycles C and C 0 in a plane
graph G are independent if G(C) and G(C 0 ) have no common vertex. An edge
e of G(C) is called an outer edge of G(C) if e is located on C; otherwise, e is
called an inner edge of G(C). An edge of G which is incident to exactly one
vertex of a simple cycle C and located outside C is called a leg of the cycle C.
The vertex of C to which a leg is incident is called a leg-vertex of C. A simple
cycle C in G is called a k-legged cycle of G if C has exactly k legs in G. The
cycle C indicated by a dotted line in Fig. 2(a) is a 3-legged cycle. In Fig. 2(a)
the three legs of C are drawn by thin lines and the three leg-vertices by black
big circles.
Let C be a 3-legged cycle in a 3-connected cubic plane graph G. Then the
three leg-vertices of C are distinct with each other since G is cubic. We denote
by CC the set of all 3-legged cycles of G in G(C) including C itself. For the
cycle C in Fig. 2(a) CC = {C, C1, C2, · · · , C7 }, where all cycles in CC are drawn
by thick lines. For any two 3-legged cycles C 0 and C 00 in CC , we say that C 00
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 35
C
1
C2
C4 C
C5
C7 C6
C1 C2 C3 C4 C5
C3 C6 C7
(b)
C
(a)
Proof: It suffices to show that one can assign two vertices of G(C) to each cycle
in CC without duplication; thus each vertex of G(C) is assigned to at most one
cycle in CC . We decide the assignment in the top-down order on the tree TC as
follows.
We first assign any two leg-vertices of C to C. For each child-cycle Ci of C
we next assign two of Ci ’s three leg-vertices to Ci . Since the child-cycles of C
are independent of each other by Lemma 1, no two child-cycles of C share any
vertex. Cycles C and Ci share at most one common leg-vertex; otherwise, Ci
would have at least four legs. The common leg-vertex may have been assigned
to C. However, since Ci has three distinct leg-vertices, Ci has at least two leg
vertices which have not been assigned yet. Thus we can assign these two leg-
vertices to Ci . In a similar fashion, for each child-cycle Cj of a child-cycle of C,
we can assign two of Cj ’s leg-vertices to Cj , and so on. Clearly the assignment
above can be done without duplication. 2
C
1
C2
C9
C8
C4
C5
C7 C6
C3
cycles, the insides of which have not been traversed. In Fig. 3 C4 , C8 and C9 are
singly traced cycles, the insides of which are shaded. During this traversal one
can easily find all 3-legged cycles in CC that share edges with C; C1 , C2 and C3
drawn in thick lines in Fig. 3 are these cycles. (Note that a 3-legged cycle in CC
sharing edges with C has two legs on C and the other leg is either an inner edge
which is traversed twice or a leg of C. Using edge-labellings similar to one in [8,
pp. 215-216], one can find such a 3-legged cycle.) Any of the remaining 3-legged
cycles in CC either is a singly traced cycle or is located inside a singly traced
cycle. One can find all 3-legged cycles inside a singly traced cycle by recursively
applying the method to the singly traced cycle. In Fig. 3 cycle C4 ∈ CC is a
singly traced 3-legged cycle, cycles C6 , C7 ∈ CC are inside C4 , cycle C5 ∈ CC is
inside C8 , and there is no 3-legged cycle inside C9 . One can also determine the
containment relation of the cycles in CC while finding them. Since the algorithm
traverses the contour of each inner face of G(C) exactly once, each edge of G(C)
is traversed at most twice. Thus the algorithm takes linear time. 2
An orthogonal drawing of a plane graph G is a drawing of G in which each
edge is drawn as a sequence of alternate horizontal and vertical line segments,
and any two edges do not cross except at their common end. A bend is defined
to be a point where an edge changes its direction in a drawing. We denote by
b(G) the minimum number of bends needed for an orthogonal drawing of G.
A rectangular drawing of a plane graph G is a drawing of G such that each
edge is drawn as a horizontal or vertical line segment, and each face is drawn
as a rectangle. Thus a rectangular drawing is an orthogonal drawing in which
there is no bend and each face is drawn as a rectangle. The drawing of G00
in Fig. 1(e) is a rectangular drawing. The drawing of G0 in Fig. 1(f) is not
a rectangular drawing, but is an orthogonal drawing. The following result on
rectangular drawings is known.
Lemma 4 Let G be a connected plane graph such that all vertices have degree
three except four vertices of degree two on Co (G). Then G has a rectangular
drawing if and only if G has none of the following three types of simple cycles
[12]:
(r1) 1-legged cycles;
(r2) 2-legged cycles which contain at most one vertex of degree two; and
(r3) 3-legged cycles which contain no vertex of degree two.
Furthermore one can check in linear time whether G satisfies the condition
above, and if G does then one can find a rectangular drawing of G in linear
time [8].
In a rectangular drawing of G, the four vertices of degree two are the four
corners of the rectangle corresponding to Co (G). A cycle of type (r1), (r2) or
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 38
C
3
C 5 C7
C2
C4
C1
C6
(r3) is called a bad cycle. Figs. 4(a), (b) and (c) illustrate 1-legged, 2-legged
and 3-legged cycles, respectively. Cycles C1 , C2 , C3 and C5 are bad cycles. On
the other hand, cycles C4 , C6 and C7 are not bad cycles; C4 is a 2-legged cycle
but contains two vertices of degree two, and C6 and C7 are 3-legged cycles but
contain one or two vertices of degree two.
Linear-time algorithms to find a rectangular drawing of a plane graph sat-
isfying the condition in Lemma 4 have been obtained [6, 8]. Our orthogonal
drawing algorithm uses the algorithm in [8], which we call Rectangular-Draw
in this paper.
3 Orthogonal Drawing
In this section we give a linear-time algorithm to find an orthogonal drawing of
a 3-connected cubic plane graph G with at most b(G) + 4 bends. Thus there
are at most four extra bends in a drawing produced by the algorithm.
Let G be a 3-connected cubic plane graph. Since G is 3-connected, G has no
1- or 2-legged cycle. Every cycle C of G has at least four convex corners, i.e.,
polygonal vertices of inner angle 90◦ , in any orthogonal drawing of G. Since G
is cubic, such a corner must be a bend if it is not a leg-vertex of C. Thus we
have the following facts for any orthogonal drawing of G.
Fact 5 At least four bends must appear on Co (G).
v2
a C2 a
C1 b b
v1
C7
v3
C3
v4
C6
C5
C4
d d
c c
cycles of C. Assume that we have already defined the classification and the
assignment for all child-cycles of C and are going to define them for C. There
are three cases.
Case 1: C has no child-cycle, that is, l = 0, and hence TC consists of a single
vertex (see Fig. 6(a)).
In this case, we classify all the three contour paths of C as green paths, and
set
bc(C) = 1. (1)
(By Fact 6 we need at least one bend on C. In Fig. 6(a) green paths of C are
indicated by dotted lines.)
Case 2: None of the child-cycles of C has a green path on C.
In this case, we classify all the three contour paths of C as green paths, and
set
l
X
bc(C) = 1 + bc(Ci ). (2)
i=1
(In Fig. 6(b) the child-cycles of C are C1 , C2 , · · · , C5 , and all green paths of
them, drawn by thick lines, do not lie on C. Since none of C1 , C2 , · · · , Cl and
their descendant 3-legged cycles has a green path on C as known later, the
orthogonal drawings of G(C1 ), G(C2 ), · · · , G(Cl) with the minimum number of
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 41
y1
P1 C1 C5 y C5
y x1 C1 y
P1
P1 z1
P2 P2
C4 C4 P2
x C3 C3
C2 C2
P3 z x x
C z z
P3 P
C 3 C
(a) Case 1 (b) Case 2 (c) Case 3
(In Fig. 6(c) P1 and P2 are green paths but P3 is a red path. For a child-cycle
Cj having a green path on C, G(Cj ) has an orthogonal drawing with bc(Cj )
bends including a bend on the green path, and hence we need not to introduce
any new bend on C.)
We have the following lemmas.
Lemma 7 At least one of the three contour paths of every 3-legged cycle in G
is a green path under the classification above.
Proof: Immediate. 2
Lemma 9 Let C be a 3-legged cycle in G, then G(C) has at least bc(C) vertex-
disjoint 3-legged cycles of G which do not contain any edge on red paths of C.
Proof: We will prove the claim by induction based on TC .
We first assume that C has no child-cycle. According to the classification
and assignment, all the three contour paths of C are green paths, and bc(C) = 1.
Clearly G(C) has a 3-legged cycle C of G which does not contain any edge on
red paths of C. Thus the claim holds for C.
We next assume that C has at least one child-cycle, and suppose inductively
that the claim holds for any descendant 3-legged cycle of C. Let C1 , C2 , · · · , Cl
be the child-cycles of C, then the hypothesis implies that, for each Ci , 1 ≤ i ≤ l,
G(Ci ) has at least bc(Ci ) vertex-disjoint 3-legged cycles of G which do not
contain any edge on red paths of Ci . There are the following two cases to
consider.
Case 1: None of the child-cycles of C has a green path on C (see Fig. 6(b)).
In this case, all the three contour paths of C are green, and bc(C) = 1 +
Pl
i=1 bc(Ci ) by (2). For each i, 1 ≤ i ≤ l, a child-cycle Ci of C has no green
path on C, and hence all Ci ’s contour paths on C are red. By the induction
hypothesis G(Ci ) has bc(Ci ) vertex-disjoint 3-legged cycles which do not contain
any edge on red paths of Ci . Therefore, these bc(Ci ) cycles do not contain any
edge on C. Furthermore by Lemma 1 the child-cycles Pl C1 , C2 , · · · , Cl of C are
independent of each other. Therefore G(C) has i=1 bc(Ci ) vertex-disjoint 3-
legged cycles
Pl of G which do not contain any edge on C. Since G is cubic, C
and these i=1 bc(Ci ) 3-legged cycles are vertex-disjoint. Trivially C does not
contain any edge on red paths of C since
Pl all the contour paths of C are green.
Thus G(C) has at least bc(C) = 1 + i=1 bc(Ci ) vertex-disjoint 3-legged cycles
of G which do not contain any edge on red paths of C.
Case 2: At least one of the child-cycles of C has a green path on C (see
Fig. 6(c)).
Pl
In this case, bc(C) = i=1 bc(Ci ) by (3). By the induction hypothesis each
cycle Ci , 1 ≤ i ≤ l, has bc(Ci ) vertex-disjoint 3-legged cycles which do not
contain any edge on red paths of Ci . Furthermore by Lemma 1 the P child-cycles
l
Ci , 1 ≤ i ≤ l, are independent of each other. Therefore G(C) has i=1 bc(Ci )
vertex-disjoint 3-legged
Pcycles which do not contain any edge on red paths of any
l
child-cycle Ci . These i=1 bc(Ci ) cycles may contain edges on green paths of Ci ,
but any green path of Ci is not contained in a red path of C P by the classification
l
of contour paths. Therefore, G(C) has at least bc(C) = i=1 bc(Ci ) vertex-
disjoint 3-legged cycles which do not contain any edge on red paths of C. 2
Lemma 10 Every 3-legged cycle C of G satisfies b(G(C)) ≥ bc(C).
Proof: By Fact 6 at least one bend must appear on each of the 3-legged cycles.
By Lemma 9 G(C) has at least bc(C) vertex-disjoint 3-legged cycles. Therefore
any orthogonal drawing of G(C) has at least bc(C) bends, that is, b(G(C)) ≥
bc(C). 2
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 43
The property (p3) implies that, in the drawing of G(C), any vertex of G(C)
except x, y and z is located in none of the following three areas (shaded in
Fig. 7): the third quadrant with the origin x, the first quadrant with the origin
y, and the fourth quadrant with the origin z. It should be noted that each leg
of C must start with a line segment on one of the six open halflines above if
an orthogonal drawing of G is extended from an orthogonal drawing of G(C)
feasible for P . Fig. 7 illustrates an orthogonal drawing feasible for a green
path P .
We will often call an orthogonal drawing of G(C) feasible for a green path
of C simply a feasible orthogonal drawing of G(C).
Lemma 11 For any 3-legged cycle C of G and any green path P of C, G(C)
has an orthogonal drawing feasible for P .
y
y
z z
x
x
bend on P
3-legged cycle C
the six halflines in property (p3)
v1 v5
v1 v5
P1 P1 y
y
t
v3
v3
v4 v4
x x
v2 v2
z z
(a) F (b) H
t v1 v5 t
y
C1 y
C5
C4
C3
v4
v3
C2
x x
z z
v2
(c) D(H) contracted vertex (d) D(G(C))
original vertex
dummy vertex
bend
to vi , depending on both the directions of the three legs and the chosen green
path of Ci , where the ends of the path are denoted by x and y. For each of the
twelve cases, we can replace a contracted vertex vi with an orthogonal drawing
of G(Ci ) feasible for the green path or a rotated one shown in Fig. 9(c), where
the drawing of G(Ci ) is depicted as a rectangle for simplicity. For example, the
embedding of the contracted vertex v1 with three legs in Fig. 8(c) is the same
as the middle one of the leftmost column in Fig. 9(b) (notice the green path
of C1 drawn in a thick line in Fig. 6(b)); and hence v1 in D(H) is replaced by
D(G(C1 )), the middle one of the leftmost column in Fig. 9(c). Clearly t is a
bend on P , and C is a rectangle in the drawing of G(C). Thus the drawing is
feasible for P . We call the replacement above a patching operation.1
Case 3: Otherwise (see Fig. 6(c)).
Let C1 , C2, · · · , Cl be the child-cycles of C, where l ≥ 1. In this case, for
1A replacement operation similar to our patching operation is used in [5].
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 46
z
x
(a)
x y x
y y y
x z z x z
z
z x z
x x
z y x z
y y y
y z y
z z z
y x y
x x x
(b)
x x
y
y
y y
x z z x z z
x
x z z
x x
z z y
y y y
y y
z z z z
y x y x
x x
(c)
Figure 9: (a) A 3-legged cycle, (b) twelve embeddings of a vertex vi and three
legs incident to vi , and (c) twelve feasible orthogonal drawings of G(Ci ) and
rotated ones.
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 47
y1 v5
v1 y1 v5 t
x1 x1
z1 y
y
P1 z1
P1
v3
v3 v
v 4
4
x
x v2
v2 z
z
(a) F (b) H
t y1 v5 Q y1 C5 y
y
C1
z1 x1 z1
x1
C4
v
4
v3 C3
C2
x x
v2 z z
contracted vertex
(c) D(H) (d) D(G(C))
original vertex
dummy vertex
bend
for any connected plane graph G. By Lemma 3 one can find the genealogical
tree TC of C in linear time. By Lemma 8 one can classify the three contour
paths as green or red paths for all cycles in CC in linear time.
We first consider the time needed for contraction and patching operations.
During the traversal of all inner faces of G(C) for constructing TC , we can find
the three leg-vertices for each cycle in CC . Given the three leg-vertices of a
3-legged cycle, we can contract the 3-legged cycle to a vertex in constant time.
Since |CC | ≤ n(G(C))/2 by Lemma 2, the contraction operations in Feasible-
Draw take O(n(G(C))) time in total. Similarly the patching operations in
Feasible-Draw take O(n(G(C))) time in total.
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 49
We then consider the time needed for operations other than the contractions
and patchings. Denote by T (G(C)) the time needed for Feasible-Draw(G(C))
excluding the time for the contractions and patchings. We claim that T (G(C)) =
O(n(G(C))). The number m(G(C)) of edges in a plane graph G(C) satisfies
m(G(C)) ≤ 3n(G(C)). Furthermore |CC | ≤ n(G(C))/2 by Lemma 2. Therefore
it suffices to prove that
By (4) we have
l
X l
X
= c · (m(H) + m(G(Ci ))) + 4 · c · |CCi |
i=1 i=1
l
X
≤ c · (m(G(C)) + 4) + 4 · c · |CCi |. (10)
i=1
l
Since CC = {C} ∪ ( ∪ CCi ), we have
i=1
l
X
|CC | = 1+ |CCi |. (11)
i=1
2
We are now ready to present our algorithm for orthogonal drawings of G,
which is shown in Fig. 11.
Algorithm Orthogonal-Draw(G)
begin
1 add four dummy vertices of degree two on Co (G);
{if Co (G) has four or more edges, then add four dummy vertices on
four distinct edges, otherwise, add two dummy vertices on two
distinct edges and two dummy vertices on the remaining edge.}
2 let G0 be the resulting graph;
3 let C1 , C2, · · · , Cl be the maximal bad cycles in G0 ;
4 for each i, 1 ≤ i ≤ l, construct genealogical trees TCi and determine
green paths and red paths for every cycle in TCi ;
5 for each i, 1 ≤ i ≤ l, find an orthogonal drawing D(G(Ci )) of G(Ci )
feasible for an arbitrary green path of Ci by Feasible-Draw;
6 let G00 be a plane graph derived from G0 by contracting each G(Ci ),
1 ≤ i ≤ l, to a single vertex vi ; {G00 has no bad cycle.}
7 find a rectangular drawing D(G00 ) of G00 by Rectangular-Draw;
8 patch the drawings D(G(C1 )), D(G(C2 )), · · · , D(G(Cl )) into D(G00 ) to
get an orthogonal drawing of G
end.
Fig. 12(a) illustrates a rectangular drawing of G00 in Fig. 5(b). The specified
green path of each of the maximal bad cycles C1 , C2 , C3 and C4 of G0 is drawn
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 51
by a thick line in Fig. 5(a). Fig. 12(b) illustrates a final orthogonal drawing of
G0 in Fig. 5(a).
b
v2 b a C2
a
v1 C1
v C3
3
C4
v4
d c d c
(a) (b)
Figure 12: (a) A rectangular drawing of G00 and (b) an orthogonal drawing of
G0 .
Theorem 1 Let G be a 3-connected cubic plane graph, let G0 be the graph ob-
tained from G by adding four dummy vertices in Algorithm Orthogonal-Draw,
and let C1 , C2 , · · · , Cl be the maximal bad cycles in G0P . Then
l
Orthogonal-Draw finds an orthogonal drawing of G with exactly 4+ i=1 bc(Ci )
Pl
bends in linear time. Furthermore, we have 4 + i=1 bc(Ci ) ≤ 4 + b(G).
Pl
disjoint 3-legged cycles. Therefore Fact 6 implies that
Pl i=1 bc(Ci ) ≤ b(G).
Thus 4 + i=1 bc(Ci ) ≤ 4 + b(G).
(b) Time complexity.
By a method similar to one in the proof of Lemma 3 we can find all maximal
bad cycles in G0 in linear time. Orthogonal-Draw calls Rectangular-Draw
for G00 and Feasible-Draw for G(Ci ), 1 ≤ i ≤ l. Both Rectangular-Draw
and Feasible-Draw run Pl in linear time. Since cycles Ci , 1 ≤ i ≤ l, are inde-
pendent of each other, i=1 n(G(Ci )) ≤ n. Therefore the total time needed by
Feasible-Draw is O(n). Furthermore all contraction operations and all patch-
ing operations can be done in time O(n) in total. Therefore Orthogonal-Draw
runs in linear time. 2
4 Bend Minimization
Algorithm Orthogonal-Draw in the preceding section finds an orthogonal
drawing of a 3-connected cubic plane graph G with at most b(G) + 4 bends.
In this section, by modifying Orthogonal-Draw, we obtain a linear-time algo-
rithm Minimum-Bend to find an orthogonal drawing of G with the minimum
number b(G) of bends. Our idea behind Minimum-Bend is as follows.
If a 3-legged cycle in G has a green path on Co (G), then we can save one
of the four bends mentioned in Fact 5, because a bend on the green path can
be a bend on Co (G) and a bend on the 3-legged cycle at the same time; hence
one of the four bends mentioned in Fact 5 has been accounted for by the bends
necessitated by Fact 6. We therefore want to find as many such 3-legged cycles
as possible, up to a total number of four. We had better to find a 3-legged cycle
which has a green path on Co (G) but none of whose child-cycles has a green
path on Co (G), because a bend on such a cycle can play also a role of a bend on
its ancestor cycle. We call such a cycle a “corner cycle”, that is, a corner cycle
is a 3-legged cycle C in G such that C has a green path on Co (G) but no child-
cycle of C has a green path on Co (G). (In Fig. 14(a) C10 and C20 drawn in thick
lines are corner cycles. On the other hand, the two 3-legged cycles indicated by
dotted lines are not corner cycles since C10 is their descendant cycle.) If G has
k(≤ 4) independent corner cycles C10 , C20 , · · · , Ck0 , then we can save k bends. By
a method similar to one given in the proof of Lemma 3 one can find independent
corner cycles of G as many as possible in linear time.
We are now ready to give the algorithm Minimum-Bend to find an orthog-
onal drawing with the minimum number of bends, which is shown in Fig. 13.
We have the following lemma.
Algorithm Minimum-Bend(G)
begin
1 find as many independent corner cycles C10 , C20 , · · · , Ck0 of G as possible,
up to a total number of four; {k ≤ 4. In Fig. 14(a) k = 2.}
0
2 let Pi1 , 1 ≤ i ≤ k, be the green path of Ci0 on Co (G);
3 let xi , yi0 and zi0 be the leg-vertices of Ci0 , and let x0i and yi0 be the
0
0
ends of Pi1 ;
4 replace each subgraph G(Ci0 ), 1 ≤ i ≤ k, in G with a quadrangle x0i t0i yi0 zi0
where t0i is a dummy vertex of degree two, and let G∗ be the resulting
graph; {See Figs. 14(a) and (b).}
5 add 4 − k dummy vertices t1 , t2 , · · · , t4−k on edges of Co (G∗ ) so that
these vertices are adjacent to none of t01 , t02 , · · · , t0k as in step 1 of
Orthogonal-Draw, and let G0 be the resulting graph; {See Fig. 14(c).}
6 let C1 , C2, · · · , Cl be the maximal bad cycles in G0 with respect to the
four dummy vertices t01 , t02 · · · , t0k and t1 , t2 · · · , t4−k of degree two;
{In Fig. 14(c) l = 2, and the insides of the two maximal bad cycles C1
and C2 are shaded.}
7 let G00 be a plane graph derived from G0 by contracting each G(Ci ),
1 ≤ i ≤ l, to a single vertex vi ; {G00 has no bad cycle. See Fig. 14(d).}
8 find a rectangular drawing D(G00 ) of G00 by Rectangular-Draw;
{The drawing of Co (G00 ) in D(G00 ) has exactly four corners t01 , t02 · · · , t0k
and t1 , t2 · · · , t4−k , and the quadrangle x0i t0i yi0 zi0 is drawn as a rectangle
for each i, 1 ≤ i ≤ k, in D(G00 ). See Fig. 14(e).}
9 find an orthogonal drawing D(G(Ci0 )) of G(Ci0 ) feasible for Pi1 0
for each
i, 1 ≤ i ≤ k, and find an orthogonal drawing D(G(Ci )) of G(Ci )
feasible for an arbitrary green path of Ci for each i, 1 ≤ i ≤ l,
by Feasible-Draw; { See Fig. 14(f).}
10 patch the drawings D(G(C10 )), D(G(C20 )), · · · , D(G(Ck0 )) and
D(G(C1 )), D(G(C2 )), · · · , D(G(Cl )) into D(G00 ) to get an
orthogonal drawing D(G) of G { See Fig. 14(g).}
end.
y1
y1 x1
y1
t1
x1
x1 z1
z1 G(C )
x2 1
C1 x2
z1 x2
t2
C2
z2 y2
z2 y
2 y
z2 2
G(C2 )
dummy vertex
G*
G
(b)
(a)
y1 v1 y1
y1 y1 t1 z1
t1 z
1 x1 z1
x1 z1
x2
C1 x2 x1
x1 t1 G(C1 )
t1 t2
z2 C2
t2 z2
z2 y2
z2 y2
v2
x2 x2
y2 y2
G(C )
t2 contracted vertex 2
t2
G
G
(d)
(c)
x1
x1 t1
t t x1
1 1
y
1
z1 y
z1 1
y1 x1 y
y z2 1
z1 z1 2
D(G(C1))
y x1 z
D(G(C1)) 1 1
v2 v y z2
2
1
z2 x2
y x2
2 z2
D(G(C2)) x
z2 2
x2 x2 t2
D(G(C2 )) y2
t2 t2
y D(G)
2
D(G )
(f) (g)
(e)
0 0 0
Proof: Let Pi1 , Pi2 and Pi3 be the contour paths of Ci0 . According to the
0
definition of a corner cycle, one of them, say Pi1 , is a green path on Co (G), but
0
none of the child-cycles of Ci has a green path on Co (G). (In Fig. 15 all green
paths of the child-cycles of Ci0 are drawn by thick lines.) Since Pi1 0
is on Co (G),
0 0
none of the child-cycles of Ci has a green path on Pi1 .
Furthermore none of the child-cycles of Ci0 has a green path on Pi2 0 0
or Pi3 .
0
Otherwise, according to Case 3 of the classification of contour paths, Pi1 would
be a red path, a contradiction.
Thus none of the child-cycles of Ci0 has a green path on Ci0 . Therefore,
according to Case 1 or 2 of the classification of contour paths, all contour paths
0 0 0
Pi1 , Pi2 and Pi3 of Ci0 are green. 2
P i1
Ci Ci j yi
xi
Ci1
Ci3
Ci2
Pi 2
Pi3
zi
Figure 15: Corner cycle Ci0 , its child-cycles, and their child-cycles.
Fig. 15 Ci0 is indicated by a dotted line, and all green paths of Ci1 0 0
, Ci2 , · · · , Cil0 i
are drawn by thick lines.) Therefore, by (1) or (2) we have
li
X
bc(Ci0 ) = 1 + 0
bc(Cij ). (13)
j=1
0 0
By Lemma 9 G(Cij ), 1 ≤ j ≤ li , has bc(Cij ) vertex-disjoint 3-legged cycles which
0
do not contain any edge on red paths of Cij . Therefore, if such a cycle contains
0 0
an edge on Cij , then the edge is necessarily on a green path of Cij , which is not
0 0
on Ci . Thus none of these cycles contains any edge on Ci , and hence contains
Pli
any edge on Co (G). Therefore, by (13), G(Ci0 ) has j=1 0
bc(Cij ) = bc(Ci0 ) − 1
vertex-disjoint 3-legged cycles which do not contain any edge on Co (G).
Since k ≤ 3, none of the maximal bad cycles Ci , 1 ≤ i ≤ l, of G0 has a green
path on Co (G); otherwise, such a cycle Ci or its descendant cycle would be a
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 57
5 Grid Drawing
In this section we give our bounds on the grid size for an orthogonal grid drawing
corresponding to an orthogonal drawing obtained by the algorithm Minimum-
Bend.
An orthogonal drawing is called an orthogonal grid drawing if all vertices
and bends are located on integer grid points. Given an orthogonal drawing, one
can transform it to an orthogonal grid drawing in linear time [10, 2 (pp. 157–
161)]. Let W be the width of a grid, that is the number of vertical lines in
the grid minus one, and let H be the height of a grid. Let n be the number of
vertices, and let m be the number of edges in a given graph. It is known that
any orthogonal drawing using b bends has a grid drawing on a grid such that
W + H ≤ b + 2n − m − 2 [1]. It is also known that any 3-connected cubic plane
graph has an orthogonal grid drawing using at most n3 + 3 bends on a grid such
that W ≤ n2 and H ≤ n2 [1, 5].
Given a 3-connected cubic plane graph G, one can find in linear time an
orthogonal drawing of G with the minimum number b(G) of bends using our
algorithm Minimum-Bend, then one can also transform it in linear time to an
orthogonal grid drawing with the same number of bends using the algorithm in
[10, 2]. The grid size of a produced drawing satisfies W +H ≤ b(G)+2n−m−2 =
b(G) + 12 n − 2 [1].
In the rest of this section we will prove that any orthogonal drawing produced
by our algorithm Minimum-Bend can be transformed to an orthogonal grid
drawing on a grid such that W ≤ n2 and H ≤ n2 . We have the following known
result on the grid size of a rectangular grid drawing [8].
n
such that W + H ≤ 2.
We now show that the following lemma holds for an orthogonal grid drawing
of G(C) for a 3-legged cycle C in G.
Proof: We only give a proof for the bound on W since the proof for the bound
on H is similar. We prove the bound on W by induction based on TC .
First consider the case where C has no child-cycle. In this case Feasible-
Draw adds a dummy vertex on C to obtain a graph F from G(C). There-
fore n(F ) = n(G(C)) + 1. Feasible-Draw finds a rectangular drawing of F
by Rectangular-Draw. By Lemma 15 the rectangular drawing of F can be
transformed to a rectangular grid drawing on a grid such that W + H ≤ n(F )
2 =
n(G(C))+1
2
. The rectangular grid drawing of F immediately gives an orthogonal
grid drawing of G(C) on the same grid regarding the dummy vertex as a bend.
Therefore the width W and the height H of the grid required for the orthogonal
grid drawing of G(C) satisfies W + H ≤ n(G(C))+12 . One can easily observe
that H ≥ 1 for any orthogonal grid drawing of G(C). Therefore, for a grid re-
quired for the orthogonal grid drawing of G(C) corresponding to the orthogonal
drawing of G(C) obtained by Feasible-Draw, W ≤ n(G(C))+1 2
− 1 = n(G(C))−1
2
.
Next consider the case where C has child-cycles C1 , C2 , · · · , Cl where l ≥ 1.
Suppose inductively that the following bound on the width Wi of a grid required
for the orthogonal grid drawing of each G(Ci ), 1 ≤ i ≤ l holds:
n(G(Ci )) − 1
Wi ≤ . (14)
2
Algorithm Feasible-Draw constructs a plane graph F from G(C) by contract-
ing each G(Ci ), 1 ≤ i ≤ l, to a single vertex, and then constructs a graph F 0
from F by either adding a dummy vertex on Co (F ) or replacing exactly one
contracted vertex on Co (F ) by a quadrangle as illustrated in Figs. 8 and 10
where F 0 = H.
Consider the case where F 0 is constructed from F by adding a dummy vertex.
In this case n(F 0 ) = n(F ) + 1. Algorithm Feasible-Draw patches orthogonal
drawings of G(Ci ), 1 ≤ i ≤ l, into a rectangular drawing D(F 0 ) of F 0 found by
Rectangular-Draw. Therefore
l
X
W ≤ WF 0 + Wi , (15)
i=1
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 59
where WF 0 is the width of the grid required for the rectangular grid drawing of
n(F 0 ) n(F )+1
F 0 . By Lemma 15 WF 0 + HF 0 ≤ 2 = 2 , where HF 0 is the height of the
grid required for the rectangular grid drawing of F 0 . Since F 0 has at least four
vertices, HF 0 ≥ 1. Hence
n(F ) + 1
WF 0 ≤ −1
2
n(F ) − 1
= . (16)
2
From (14), (15) and (16) we have
l
n(F ) − 1 X n(G(Ci )) − 1
W ≤ +
2 2
i=1
Pl
n(F ) + i=1 (n(G(Ci )) − 1) − 1
= . (17)
2
During the patching operation exactly one contracted vertex is replaced by the
orthogonal drawing of each G(Ci ), and hence
l
X
n(F ) + (n(G(Ci )) − 1) = n(G(C)). (18)
i=1
where WF 0 is the width of the grid required for the rectangular grid drawing of
0
F 0 . By Lemma 15 WF 0 + HF 0 ≤ n(F2
)
= n(F2)+3 , where HF 0 is the height of the
grid required for the rectangular grid drawing of F 0 . Since HF 0 ≥ 1,
n(F ) + 1
WF 0 ≤ . (20)
2
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 60
and WG00 respectively are the width and the height of the grid. Since G is a
3-connected plane graph, HG00 ≥ 2. Hence
n(G00 )
WG00 ≤ − 2. (23)
2
Algorithm Minimum-Bend patches the orthogonal drawings of G(C10 ),
G(C20 ), · · · , G(Ck0 ) and G(C1 ), G(C2), · · · , G(Cl ) into the rectangular drawing
of G00 and get an orthogonal drawing of G. During the patching operation, the
drawing of each G(Ci0 ), 1 ≤ i ≤ k, replaces the drawing of a quadrangle, and
the drawing of each G(Ci ), 1 ≤ i ≤ l, replaces a contracted vertex in G00 . The
width of a quadrangle on a grid is at least one. Thus one can observe that the
width W of a grid required for an orthogonal grid drawing of G obtained by
algorithm Minimum-Bend satisfies the following relation.
k
X l
X
W ≤ WG00 + (Wi0 − 1) + Wi , (24)
i=1 i=1
where Wi0 is the width of the grid required for an orthogonal grid drawing of
G(Ci0 ) for 1 ≤ i ≤ k and Wi is the width of the grid required for an orthogonal
grid drawing of G(Ci ) for 1 ≤ i ≤ l. Then by Lemma 16, Eqs. (23) and (24) we
have
Xk Xl
n(G00) n(G(Ci0 )) − 1 n(G(Ci )) − 1
W ≤ −2+ ( − 1) +
2 2 2
i=1 i=1
P k P l
n(G00) + i=1 (n(G(Ci0 )) − 3) + i=1 (n(G(Ci )) − 1) − 4
= . (25)
2
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 61
n n
From (25) and (26) we have W ≤ 2. Similarly we can prove H ≤ 2. Thus we
have the following theorem.
6 Conclusions
In this paper we have presented a linear-time algorithm to find an orthogonal
drawing of a 3-connected cubic plane graph with the minimum number of bends.
It is left as future work to find a linear-time algorithm for a larger class of graphs.
References
[1] T. C. Biedl. Optimal orthogonal drawings of triconnected plane graphs.
Proc. of SWAT’96, Lect. Notes in Computer Science, 1097, pp. 333-344,
1996.
[2] G. Di Battista, P. Eades, R. Tamassia and I. G. Tollis. Graph Drawing: Al-
gorithms for the Visualization of Graphs, Prentice-Hall Inc., Upper Saddle
River, New Jersey, 1999.
[3] A. Garg and R. Tamassia. On the computational complexity of upward
and rectilinear planarity testing. Proc. of Graph Drawing’94, Lect. Notes
in Computer Science, 894, pp. 286-297, 1995.
[4] A. Garg and R. Tamassia. A new minimum cost flow algorithm with
applications to graph drawing., Proc. of Graph Drawing’96, Lect. Notes in
Computer Science, 1190, pp. 201-226, 1997.
[5] G. Kant. Drawing planar graphs using the canonical ordering., Algorith-
mica, 16, pp. 4-32, 1996.
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 62
[6] G. Kant and X. He. Regular edge labeling of 4-connected plane graphs and
its applications in graph drawing problems. Theoretical Computer Science,
172, pp. 175-193, 1997.
[7] M. S. Rahman, S. Nakano and T. Nishizeki. A linear algorithm for optimal
orthogonal drawings of triconnected cubic plane graphs. Proc. of Graph
Drawing’97, Lect. Notes in Computer Science, 1353, pp. 99-110, 1998.
[8] M. S. Rahman, S. Nakano and T. Nishizeki. Rectangular grid drawings of
plane graphs. Comp. Geom. Theo. Appl., 10, pp. 203-220, 1998.
[9] J. Storer. On minimum node-cost planar embeddings. Networks, 14, pp.
181-212, 1984.
[10] R. Tamassia. On embedding a graph in the grid with the minimum number
of bends. SIAM J. Comput., 16, pp. 421-444, 1987.
[11] R. Tamassia, I. G. Tollis and J. S. Vitter. Lower bounds for planar orthog-
onal drawings of graphs. Inf. Proc. Letters, 39, pp. 35-40, 1991.
[12] C. Thomassen. Plane representations of graphs. (Eds.) J.A. Bondy and
U.S.R. Murty, Progress in Graph Theory, Academic Press Canada, Don
Mills, Ontario, pp. 43-69, 1984.
Journal of Graph Algorithms and Applications
http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 4, pp. 63-79 (1999)
T. Shermer
School of Computing Science, Simon Fraser University
Burnaby, BC V5A1A6, Canada
S. Whitesides
School of Computer Science, McGill University
Montreal, PQ H3A2A7, Canada
S. Wismath
Department of Mathematics and Computer Science, University of Lethbridge
Lethbridge, AB T1K3M4, Canada
Abstract
This paper studies 3-D orthogonal grid drawings for graphs of arbi-
trary degree, in particular Kn , with vertices drawn as boxes. It estab-
lishes asymptotic lower bounds for the volume of the bounding box and
the number of bends of such drawings and exhibits a construction that
achieves these bounds. No edge route in this construction bends more
than three times. For drawings constrained to have at most k bends on
any edge route, simple constructions are given for k = 1 and k = 2. The
unconstrained construction handles the k ≥ 3 cases.
The authors gratefully thank N.S.E.R.C. for financial assistance. The conference ver-
sion of this paper appeared in the proceedings of Graph Drawing ’97. These joint
results were also presented as part of the Ph.D. thesis of T. Biedl at Rutgers Univer-
sity. This work was done while the fourth author was on sabbatical leave at McGill
University.
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 64
1 Introduction
This paper offers upper and lower bounds for the volume and the total number
of bends in 3-D orthogonal grid drawings for graphs of arbitrary degree. In
particular, we study how the volume depends on the maximum number of bends
permitted per edge. All of our constructions have a total number of bends that
is asymptotically optimal, and one construction also exhibits asymptotically
optimal volume. To state the main results clearly, we first give some terminology
and the drawing conventions and volume measure used.
A grid point is a point in R3 whose coordinates are all integers. A grid box
is the set of all points (x, y, z) in R3 satisfying x0 ≤ x ≤ x1 , y0 ≤ y ≤ y1 and
z0 ≤ z ≤ z1 for some integers x0 , x1 , y0 , y1 , z0 , z1 . A grid box is said to have
dimensions a×b×c whenever x1 = x0 +a−1, y1 = y0 +b−1, and z1 = z0 +c−1.
The volume of such a box is defined to be the number of grid points it contains,
namely abc. For example, a single grid point is a 1 × 1 × 1 box of volume 1.
The volume of a drawing is the volume of its bounding box, which is the smallest
volume grid box containing the drawing. Often we refer to the bounding box
as an X × Y × Z-grid.
Throughout this paper, a 3-D orthogonal grid drawing of a graph G = (V, E)
is a drawing that satisfies the following. Distinct vertices of V are represented
by disjoint grid boxes. While in general these boxes may be degenerate, i.e.,
they may have dimension 1 with respect to one or more coordinate directions,
such degeneracies can be avoided, as we describe later. An edge e = (v1 , v2 ) of
E is drawn as a simple path that follows grid lines, possibly turning (“bending”)
at grid points; the endpoints of the path for e are grid points that are extremal
points for the boxes representing v1 and v2 . The intermediate points along the
path for an edge do not belong to any vertex box, nor do they belong to any
other edge path. See Fig. 1. In what follows, graph theoretic terms such as
vertex are typically used to refer both to the graph theoretic object and to its
representation in a drawing.
vertices as single grid points. See for example [23], [2], [19]. More recently, 2-D
orthogonal grid drawings of higher degree graphs have been investigated, where
vertices have been drawn as rectangular boxes. See for example [12], [18], [3].
At present, there are few results on 3-D orthogonal grid drawings. Rosenberg
showed that any graph of maximum degree 6 can be embedded in a 3-D grid
of volume O(n3/2 ) and that this is asymptotically optimal [22]. No bounds on
the number of bends were given. Recently, Eades, Symvonis and Whitesides
gave
√ a method for drawing graphs of maximum degree 6 in a grid of side-length
4 n, with vertices represented by single grid points and each edge having at
most 7 bends [9]. They also gave a simple method for drawing such graphs in
a grid of side-length 3n, creating at most 3 bends on each edge. This volume
was subsequently improved to at most 4.66n3 [20] and then to volume at most
2.37n3 [27]. For graphs with maximum degree 5, volume n3 and 2 bends per
edge suffice [27].
As for drawings with higher degree, only two papers are known to the au-
thors. Papakostas and Tollis showed how to draw graphs in a 3-D grid of volume
O(m3 ) ≤ O(n6 ) [20]. Very recently, Biedl [1] extended the techniques presented
here and showed how to draw graphs in a 3-D grid of volume O(n3 ). Neither
paper matches our upper bound volume of O(n2.5). However, both papers yield
constructions where vertex boxes have a more cube-like appearance. This sug-
gests a trade-off between cube-like appearance of of vertex boxes and volume.
Note that for k ≥ 3, the upper and lower bounds on the volume match
(within a constant factor) when a maximum of k bends per edge is allowed.
The constructions of this paper have reasonably small constant factors for the
volume. Only for the k = 1 and k = 2 cases do the bounds on the volume not
match; in each of these cases we give an O(n3 ) volume drawing of Kn and leave
as an open problem whether this drawing indeed has asymptotically optimum
volume.
2 Lower Bounds
2.1 A lower bound on the volume
Recall that vol(n) is the minimum possible volume for a drawing of Kn . This
definition is valid since, as later sections show, every Kn has a drawing if edges
are allowed to bend. The main result of this section is to show that vol(n) is in
Ω(n2.5 ).
A z-line is a line that is parallel to the z-axis; y-lines and x-lines are defined
analogously. A (z = z0 )-plane is a plane that is orthogonal to the z-axis and
intersects the z-axis at coordinate z0 ; (x = x0 )-planes and (y = y0 )-planes are
defined analogously.
1
Theorem 1 vol(n) ∈ Ω(n2.5 ). In fact, for any 0 < ε < 4
, we have vol(n) ≥
min{( 41 − ε)n5/2 , f(n)} where f(n) ∈ Θ(n3 ).
sweeps the (z = z0 )-plane. At any time, this y-line intersects fewer than 2δn
vertices by assumption.
During the sweep by the (x = x0 )-plane, an integer x∗ is encountered where,
for the last time, there are fewer than ( 12 −2δ)n vertices left of the (x = x∗ )-plane
and intersecting the (z = z0 )-plane. See the top right picture in Fig. 2. Since
the y-line determined by the (x = x0 )-plane intersects fewer than 2δn vertices,
and the (z = z0 )-plane intersects at least (1 − 2δ)n vertices by assumption, at
least (1 − 2δ)n − ( 12 − 2δ)n − 2δn = ( 12 − 2δ)n vertices intersect the (z = z0 )-plane
and lie right of the (x = x∗ )-plane. All these vertices also lie to the right of
(x = x∗ + 12 )-plane.
By definition of x∗ , the number of vertices that intersect the (z = z0 )-plane
and that lie left of the (x = x∗+1)-plane is at least ( 12 − 2δ)n. All these vertices
also lie to the left of (x = x∗+ 12 )-plane.
There are at least ( 12 − 2δ)2 n2 edges between the vertices on the left and the
vertices on the right of the (x = x∗+ 12 )-plane, so Y Z ≥ ( 12 − 2δ)2 n2 = 14 (1 −
4δ)2 n2 . Apply exactly the same argument in the y-direction to obtain XZ ≥
1 2 2
4 (1 − 4δ) n . Finally, note that XY ≥ (1 − 2δ)n ≥ (1 − 4δ)n, √
since the (z = z0 )-
plane
q intersects (1 − 2δ)n vertices. Consequently, XY Z = Y Z · XZ · XY ≥
1
16
(1 − 4δ)5 n5 = 14 (1 − 4δ)5/2 n5/2 > ( 14 − ε)n5/2 by the choice of δ.
Case 3: No plane intersects many vertices
Assume now that no plane intersects as many as (1 − 2δ)n vertices. As an
(x = x0 )-plane is swept from smaller to larger values of x0 , by an argument
analogous to the one in Case 2 a value x∗ (not necessarily integral) will be
encountered for which at least δn vertices lie left of the (x = x∗ )-plane and at
least δn vertices lie right of the (x = x∗)-plane. See the bottom picture in Fig. 2.
Consequently, the (x = x∗)-plane contains at least δ 2 n2 points with integer y-
and z-coordinates, and Y Z ≥ δ 2 n2 . Since the same argument holds for the
other two directions, XY Z ≥ (δ 2 n2 )3/2 = δ 3 n3 ∈ Θ(n3 ).
For all sufficiently large n, the bound given by Case 2 is the smallest of the
three; hence vol(n) ∈ Ω(n5/2 ). 2
direction of visibility. Each class of edges forms a graph that has a visibility
representation using only one direction of visibility. Our lower bound result
depends on the fact that K56 has no such visibility representation, as shown in
[10].
Lemma 1 For all sufficiently large n, Kn has no bend-free 3-D orthogonal grid
drawing.
Proof: The 3-Ramsey number R(r, b, g) is the smallest number such that any
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 70
arbitrary coloring of the edges of KR(r,b,g) with colors red, blue and green induces
either a red Kr , or a blue Kb , or a green Kg as a subgraph. This number exists
and is finite; see for example [13].
Assume Kn , n > R(56, 56, 56), is drawn without a bend. Color an edge red
if it is parallel to an x-line, green if it is parallel to a y-line, and blue if it is
parallel to a z-line. By the choice of n, we must have a monochromatic K56 ,
which contradicts the fact that K56 has no visibility representation using only
one direction of visibility. Therefore Kn must have a bend in any 3-D orthogonal
grid drawing. 2
Fekete and Meijer [11] independently proved this lemma. They were inter-
ested in obtaining good bounds for the minimum such n, and therefore gave a
longer proof to show that K184 requires a bend in any 3-D orthogonal drawing.
One consequence of this lemma is that bend(n) ∈ Ω(n2 ).
Proof: Let c be an integer (e.g., 184) such that any 3-D orthogonal
grid drawing
of Kc has a bend. For n > c, the graph Kn contains nc copies of a Kc . Each
of these copies must have a bend. Any edge of Kn belongs to exactly n−2 c−2 of
these copies of Kc . Consequently, the number of edges with a bend must be at
least
n2
n
n! (c − 2)!(n − c)! n(n − 1)
c
n−2 = c!(n − c)! = ≥ 2
c−2
(n − 2)! c(c − 1) c
for n ≥ c. 2
3 Constructions
The lower bound of Section 2.1 provides a volumetric goal for layout strategies
for drawings with at most k bends per edge. This section presents a construction
that achieves this lower bound with a small constant factor. For the k = 1 case,
two strategies are described and then modified to give a drawing for the k = 2
case. A simple construction that realizes the Ω(n2.5 ) lower bound for volume is
described in Subsection 3.3. The construction generates at most 3 bends on any
edge and hence is valid for each k ≥ 3. Whether the lower bound is attainable
when k = 1 or 2 remains an open problem.
In each of the constructions, vertices are first placed as points in a 2-D
xy-plane. Next, all the edges are routed in the same xy-plane, with overlap
and crossings of edges temporarily permitted. Then a number Z of z-planes is
introduced, and edges are assigned to these planes so that no edges overlap or
cross. The vertices are stretched into segments of z-lines.
While the VLSI and MCM literature proposes many layout constructions of
similar flavor (see e.g. [14]), our work differs from those results in several aspects.
Our constructions provide proof techniques for obtaining upper bounds for Kn ;
by contrast, the VLSI literature aims to provide usable layout heuristics and
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 71
algorithms for arbitrary input graphs. Another important difference is that the
constraint on the maximum number of bends per edge that we study in this
paper is apparently not an issue for the VLSI and MCM technologies.
3.1.2 Drawing Kn in an n
2 × n × n2 -grid for k = 1
Let K 1 and K 2 denote two drawings of Kn/2 with coordinates as described in
the proof of the previous lemma. Thus each drawing has an n2 × n2 × n2 bounding
box and initially, K 1 and K 2 are superimposed. Rotate K 2 and its bounding
box about the y-axis clockwise by 90 degrees (looking towards +∞). Then
rotate it about the x-axis by 180 degrees. In this rotated K 2 , vertex vj contains
the points {(x, −j, j)|1 ≤ x ≤ n2 }. See Fig. 4.
z B D z
A C
y y
F H F B
E E
(0, 0, 0) G x
A x
H D
G
C
z z
G C K1
H D y y
K2
E A x x
F
B
Figure 4: Rotate K 2 twice: first by 90 degrees about the y-axis, and then by
180 degrees about the x-axis. Finally, we show the combination of K 1 and the
rotated K 2 . The gray area is the area that contains edges of K 2 .
Each vertex vi in K 1 sees each vertex vj in the rotated K 2 along the y-line
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 73
segment [(i, i, j), (i, −j, j)]. Therefore, these edges can be drawn as straight line
segments, thus producing a drawing of Kn . The unused (y = 0)-plane can be
deleted to give a drawing with dimensions X = Z = n2 and Y = n.
3.2.1 Drawing in an n × n
2 × n-grid
Enumerate the vertices as {v1 , . . . , vn } and place vi at (x, y) = (i, 1) in a 2-D
xy-plane. To route edge e = (vi , vj ), where i < j, let y = d j−i 2
e and route e via
the points (i, 1), (i, y), (j, y), (j, 1), creating two bends if y > 1 and no bends if
y = 1.
Define the edge sets Eia and Eib as above. Again there are neither crossings
nor overlaps among edges in the same set and so n z-planes suffice. Since the
largest y-coordinate is d n−1 2
e, the bounding box has dimensions n × n2 × n.
Figure 5: The edge sets of K8 drawn with at most two bends per edge.
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 74
3.2.2 Drawing in an n
2 × n
2 × n2 -grid
Let K 1 and K 2 denote two drawings of Kn/2 with coordinates as described in
the proof of the previous lemma. Thus each drawing has an n2 × n4 × n2 bounding
box and initially, K 1 and K 2 are superimposed. Rotate the bounding box of
K 2 as described in Section 3.1.2 and Fig. 4. Then vertex vj of the rotated K 2
contains the points {(x, −1, j)|1 ≤ x ≤ n2 }. See Fig. 6.
z
K1 y
K2
x
Each vertex vi in K 1 sees each vertex vj in the rotated K 2 along the y-line
segment [(i, 1, j), (i, −1, j)]. Therefore, these edges can be drawn as straight
lines, thus producing a drawing of Kn . The unused (y = 0)-plane can be deleted
to give a drawing with dimensions X = Y = Z = n2 .
construction, and the bound on the number of bends follows from Lemma 3,
since we have at most 2(( N2 )2 − 3 N2 + 2) bends. 2
Remark: Since N ≤ n + 3, our construction has a volume of 18 n3 + O(n2 ).
y y
2dy
2dx + 2dy
0 2
Figure 7: The edge sets E1,2 and E1,2 .
√ √ √
Remark: Since r = d n e < n+1, we have N ≤ n+2 n, so our construction
has a volume of 16
3
N 2.5 = 16
3
n2.5 + O(n2.25 ).
4 Conclusions
This paper is one of the first to address volume and bend considerations for 3-D
orthogonal grid drawings of graphs. The focus has been on Kn , since it is the
most difficult graph on n vertices to draw in small volume or with restrictions
on bends. In particular, we have
An open problem is to close the gap between the upper and lower bounds in
the k = 1 and k = 2 cases, where at most 1 and at most 2 bends on each edge
are permitted, respectively. Another interesting problem is to find upper and
lower bounds that depend not only on the number of vertices n but also on the
number of edges m.
5 Acknowledgments
Thanks to Michael Kaufmann for discussions on orthogonal drawings, and to
Sándor Fekete for pointing out reference [11].
References
[1] T. Biedl. Three approaches to 3D-orthogonal box-drawings. In Whitesides
[25], pages 30–43.
[2] T. Biedl and G. Kant. A better heuristic for orthogonal graph drawings.
Computational Geometry: Theory and Applications, 9:159–180, 1998.
[3] T. Biedl, B. Madden, and I. Tollis. The three-phase method: A unified
approach to orthogonal graph drawing. In Di Battista [7], pages 391–402.
[4] P. Bose, H. Everett, S. Fekete, M. Houle, A. Lubiw, H. Meijer, K. Romanik,
G. Rote, T. Shermer, S. Whitesides, and C. Zelle. A visibility representation
for graphs in three dimensions. J. Graph Algorithms Appl., 2(3):1–16, 1998.
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 78
Ioannis G. Tollis
Dept. of Computer Science
The University of Texas at Dallas
Richardson, TX 75083-0688
tollis@utdallas.edu
Abstract
We present two algorithms for orthogonal graph drawing in three di-
mensional space. For a graph with n vertices of maximum degree six,
the 3-D drawing is produced in linear time, has volume at most 4.63n3
and has at most three bends per edge. If the degree of the graph is ar-
bitrary, the vertices are represented by solid 3-D boxes whose surface is
proportional to their degree. The produced drawing has two bends per
edge. Both algorithms guarantee no crossings and can be used under an
interactive setting (i.e., vertices arrive and enter the drawing on-line), as
well.
1 Introduction
Graph drawing addresses the problem of automatically generating geometric
representations of abstract graphs or networks. For a survey of graph draw-
ing algorithms and other related results see the book by Di Battista, Eades,
Tamassia and Tollis [10]. An orthogonal drawing is a drawing in which ver-
tices are represented by points of integer coordinates and edges are represented
by polygonal chains consisting of horizontal and vertical line segments. Vari-
ous algorithms have been introduced to produce orthogonal drawings of planar
[2, 15, 20, 34, 36] or general [2, 24, 27, 33] graphs of maximum degree 4, and
maximum degree 3 [20, 23, 24]. All these algorithms run in linear time, except
for the algorithm in [34]. For drawings of general graphs, the required area can
be as little as 0.76n2 [24, 27], the total number of bends is no more than 2n + 2
[2, 24, 27], and at most two bends can be on the same edge [2, 24, 27].
There has been a recent trend in Graph Drawing to visualize graphs in the
three dimensional space. Although the number of applications that require such
a representation for graphs is still limited [4, 17, 22, 31, 32, 37, 38], there is no
doubt that 3-D Graph Drawing will find many applications in the future.
A number of software systems that produce straight-line 3-D drawings of
graphs have been introduced. In the case of [5], the system is based on the
spring-embedder paradigm [19]. Spring-embedders use a physical model based
on vertices treated as currents exerting a repulsive force, while edges are modeled
as forces attracting the vertices they combine.
Simulated Annealing has also been used [8] to produce straight-line 3-D
drawings of graphs. The idea here is that there is a predefined cost associated
with the current 3-D drawing of the graph, and the system moves to drawings of
lower costs (while sometimes accepting higher cost drawings if they look ‘nice’),
until no further improvement is possible. Other special purpose systems are
described in [11, 32].
Little is known about the theory of 3-D Graph Drawing. The concept of a
visibility representation of a graph [35] has been extended to 3-D space, known
as 3-D visibility representations of graphs. Research in this area [1, 3, 6, 16, 18]
has revealed characterizations of several families of graphs and other theoretical
results. In [7] it is shown that an n-vertex graph has a non-orthogonal 3-D
drawing in a n × 2n × 2n grid, so that all vertices are located on grid points, and
no two edges cross. In the same paper, a technique to convert an√orthogonal √ 2-D
drawing of area H ×V to a 3-D straight-line drawing of volume d He×d He×V
is also presented.
Naturally, orthogonal drawing in three dimensional space has also received
attention recently [4, 5, 8, 12, 13, 17, 32]. A 3-D orthogonal drawing typically
has the following properties:
• Vertices are points with integer coordinates in three dimensional space.
• Each edge is a polyline sequence of consecutive straight line segments;
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 83
each one of these line segments is parallel either to the x-axis, y-axis, or
z-axis.
• The meeting point of two consecutive straight line segments of the same
edge is a bend and has integer coordinates.
• Line segments coming from routes of two different edges are not allowed
to overlap.
A very interesting upper bound on the volume for 3-D orthogonal drawings
of graphs of maximum degree 6 is √shown in√[13]. More√ specifically, the volume
for such drawings is at most O( n) × O( n) × O( n), while each edge has
at most seven bends, and no two edges cross. This improves the result in [12],
where the volume upper bound was the same but the drawings allowed up to
16 bends per edge. If we require that each edge has at most three bends, then
another algorithm is presented in [13] that requires volume exactly 27n3 (the
3
produced drawings have no crossings). Both algorithms run in O(n 2 ) time.
Note that Kolmogorov and Bardzin [21] show an existential lower bound of
3
Ω(n 2 ) on the volume occupied by 3-D orthogonal grid drawings of graphs of
maximum degree 6.
In this paper we present an algorithm for producing 3-D orthogonal drawings
of simple graphs of maximum degree 6, and a second algorithm that produces 3-
D orthogonal drawings of simple graphs of arbitrary degree. Note that there has
not been any previous work that dealt with the theory of 3-D orthogonal drawing
of graphs of arbitrary degree. Both algorithms are based on the ‘Relative-
Coordinates’ paradigm for vertex insertion [25, 26, 28]. As such, both algorithms
support interactive environments where vertices arrive and enter the drawing
on-line. An important feature of this work is that both algorithms guarantee
no edge crossings.
Given an n-vertex graph G of maximum degree 6, our first algorithm pro-
duces a 3-D orthogonal drawing of G whose volume is at most 4.63n3, in linear
time. Moreover, each edge of the drawing has at most three bends. Hence, our
algorithm outperforms the algorithm of [13] in terms of both running time and
volume of the drawing. Our second algorithm uses solid three dimensional boxes
to represent vertices. The surface of each such box is proportional to the degree
of the represented vertex. The produced 3-D orthogonal drawings have at most
two bends per edge, and volume O(( m 3
+ O(n))3 ), where m is the number of
edges of the drawing.
2 Preliminaries
Clearly, for each graph of maximum degree 6, there is a 3-D orthogonal drawing
according to the definition of the previous section. The system of coordinates
typically used in three dimensional space is based on three axes x, y, z so that
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 84
each one of them is perpendicular to the other two (see Fig. 1a). Three different
planes are formed by the three possible ways we can pair these axes: The xz-
plane is defined by the x, z-axes, the yz-plane is defined by the y, z-axes, and
the xy-plane is defined by the x, y-axes. Each one of these planes is called a
base plane; each base plane is perpendicular to the other two.
top
p
z
ck
y
ba
left v
right
e’ v
nt
bottom
fro
x e
(a)
(b) (c)
Figure 1: (a) Coordinates system for 3-D drawing, (b) possible directions from
where an edge can enter v, (c) v’s left free direction is blocked.
Each vertex of a 3-D drawing has six possible directions around it from
where incident edges may enter the vertex. The two directions parallel to the
z-axis are top (extending towards the positive part of the z-axis) and bottom
(extending towards the negative part of the z-axis). Front and back directions
are parallel to the y-axis and they extend towards the negative and positive
parts of the y-axis, respectively. The remaining two directions are parallel to
the x-axis and are called left (extending towards the negative part of the x-axis)
and right (extending towards the positive part of the x-axis), see also Fig. 1b.
Two directions parallel to the same axis are opposite directions. Two direc-
tions parallel to two different axes are orthogonal directions. If there is no edge
entering a vertex v from a specific direction of v, this direction is called free
direction of v. A free direction of v is blocked by straight line segment e, if we
can draw a straight line from v along the free direction that intersects e. Such
a situation is depicted in Fig. 1c: v and e are both placed in plane p which is
parallel to the xy-plane. v’s left free direction is blocked since line e0 (which is
parallel to the x-axis and extends towards the negative part of this axis) crosses
line e.
A plane free direction is a left, right, front, or back free direction. Consider
vertices v1 , v2 , · · · vr , where r ≥ 2, having plane free directions fd1 , fd2 , · · · fdr
which extend towards the same direction (e.g., they are all left free directions).
The set of the fdi ’s forms a beam. If the fdi ’s are left (resp. right, front,
back) free directions, then their beam is a left (resp. right, front, back) beam.
Vertices v1 , v2 , · · · vr are the origins of the beam. Two beams are opposite (resp.
orthogonal) if the free direction of one beam is opposite (resp. orthogonal) to
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 85
w
w w
w’ w’
(b) w’ (c)
(a)
p p
z,w
w w
w’ w’
w’ w’ (e)
(d)
Figure 2: (a) First, (b) Second, (c) Third Fundamental Routes, (d) Same-Plane,
(e) Over-The-Top Routes.
• First Fundamental Route: Edge (w0 , w) enters w from its left free
direction. We open up a new plane p to the left of the leftmost plane of
the current drawing. Edge (w 0 , w) is routed with three bends as follows:
w 0 → p → py,w → pz,w → w. This is shown in Fig. 2a. The small empty
circles of this figure denote the three bends of the route.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 87
• Same-Plane Route: Edge (w 0 , w) may enter w from any one of its plane
free directions. We draw a straight line segment from w 0 intersecting plane
pz,w perpendicularly. The remaining portion of edge (w0 , w) is routed ex-
clusively in pz,w , and may enter w from any one of its plane free directions
with at most two bends (if two bends are required, then a new plane par-
allel either to the xz or yz-plane has to be inserted). This means that the
whole route has at most three bends. In Fig. 2d we show three examples
of the portions of three routes in plane pz,w .
• Over-The-Top Route: Edge (w 0 , w) enters w from its top free direction.
A new plane p parallel to the xy-plane is inserted in the drawing, one unit
above w. Edge (w 0 , w) is routed with three bends (see Fig. 2e) as follows:
w 0 → p → px,w → py,w → w. In other words, we draw a straight line
segment intersecting p perpendicularly, route the edge in p bringing it
directly on top of w with one bend, and then just draw the line segment
from that point to w.
Note that if more than one edge is routed to vertex w using the Same-Plane
Route, we have to make sure that: (a) There are no crossings between any two
portions of these edges lying in plane pz,w , and (b) no portion of such an edge
in pz,w blocks any one of w’s remaining (i.e., after all edges are routed) free
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 88
directions. These requirements can always be satisfied as long as: (a) the points
in pz,w where the edges intersect pz,w have general position (i.e., no two points
are in the same row or column of pz,w ), and (b) there are no portions of non
Same-Plane Routes in plane pz,w . In Fig. 2d, we show how three edges starting
from generally positioned points are routed to w with at most two bends. Note
that w’s left free direction is not blocked as a result of the routing.
v
v2
v u2 u
c
v
v1 u3
ua ua (d)
(c)
u1 u4
(a)
(b)
Figure 3: (a) Inserting the first two vertices, (b) a Routing Case 1 example, (c)
(ua , v) of Routing Case 1 when ua does not have top connector, (d) (uc , v) of
Routing Case 2 when uc does not have top connector.
For each adjacent vertex ui , we must pick one of its free directions which will
be used for routing edge (ui , v). The free direction picked for each ui is called ui ’s
connector. Once a connector for an adjacent vertex ui is determined, it remains
the same throughout the whole process of placing v and routing its incident
edges. If a connector of some ui is a right (left, front, back, top) free direction,
then it is called right (left, front, back, top) connector. Opposite, orthogonal,
and plane connectors are defined in the same way as for free directions. Also,
a beam of connectors is defined similarly to the beam of free directions. Let ci
be ui ’s connector. We run the following procedure to determine the connector
of each ui .
1. Choose a free direction fdi for each ui so that:
(a) The number of pairs < fdi , fdj > (i 6= j and 1 ≤ i, j ≤ l) where fdi
and fdj are opposite, is the smallest possible.
(b) fdi is top free direction, only if ui has only this free direction left.
2. IF there are no two opposite beams among the fdi ’s, THEN
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 90
v
v
uB uc
(a) (b)
Figure 4: Routing Case 3: (a) routing the edge coming from vertex uB when
uB is an origin of the beam opposite to Bmax , (b) edge (uc , v) when uc does not
have top connector.
back connector, then edge (u0 , v) is routed using the First Fundamental Route.
If u0 has top connector, then edge (u0 , v) is routed using the Same-Plane Route.
In this case, edge (u0 , v) enters vertex v from its front (back) free direction if
the y-coordinate of u0 is lower (higher) than that of v.
Consider the case where Bmax has three origins. If the y-coordinate of
anchor ua is lower (higher) than that of v, let u0 be the origin of Bmax whose
y-coordinate is lower (higher) than that of ua . Edge (u0 , v) is routed using the
Third Fundamental Route entering v from its front (back) free direction.
The remaining incident edges of v are routed as follows: Let u00 be Bmax ’s
origin whose edge has not been routed yet. We route edge (u00 , v) using the
First Fundamental Route. As a result of routing v’s incident edges so far, either
v’s back or v’s front free direction is available. If v’s back (front) free direction
is available, let uB be the origin of B having higher (lower) y-coordinate than
that of v. We open up a new plane p0 to the right of the rightmost plane of
the current drawing, and route edge (uB , v) with three bends (see Fig. 4a) as
follows: uB → p0 → p3 → p1 → v.
Note that edge (uB , v) is routed on top of the current drawing, all the way
from the rightmost to the leftmost side of the drawing. Although this edge
passes directly over uB , this will not create any crossings in the future since
uB ’s top free direction is not available. Let u0B be the other origin of B. Edge
(u0B , v) is routed using the First Fundamental Route.
Let us now consider the situation where l = 6 and there is no adjacent vertex
with top connector. If B has cardinality 3, then cover uc is the origin of B which
is between the other two origins of B with respect to the y-coordinate. If B
has cardinality 2, then cover uc is the origin of B with the lowest (highest) y-
coordinate of the two if there is an adjacent vertex with front (back) connector.
Anchor ua is the median of the origins of Bmax with respect to the y-coordinate.
Planes p1 , p3 are inserted as described in the previous case, and plane p2 is
identical to py,uc . Vertex v is placed at the intersection of planes p1 , p2 , p3 , and
edge (ua , v) is routed with two bends as described in the previous case.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 94
If there are adjacent vertices with front or back connectors, the edges that
come from them are routed using the First Fundamental Route. Any edge
coming from an origin of B (different from uc ) is routed in the way uB was
routed (see Fig. 4a), only if the front and/or back free directions of v are
available. If neither of these two free directions of v is available, then the edge
coming from B’s origin (different from uc) is routed to the right free direction of
v using the First Fundamental Route. Edges coming from the origins of Bmax
are routed using the First, Second, and Third Fundamental Routes.
Two new planes pc and p0c are inserted so that pc is to the right of the
rightmost plane of the current drawing and p0c is parallel to p3 and one unit to
the top of it. Edge (uc , v) is routed with three bends (see Fig. 4b) as follows:
uc → pc → p0c → p1 → v. The top free direction of uc is not available, so
there can be no future edge incident to uc crossing edge (uc , v). Finally, note
that since placing v and routing edge (ua , v) requires only two new planes (i.e.,
p1 , p3 ), the total number of new planes that we open up in order to route all six
of v’s incident edges is at most eight.
vertically from plane pz,u to plane pz,v . This segment always lies entirely outside
the current drawing, so it does not cross any other edge.
Finally, the third stage consists of the portion of the route that runs entirely
in plane pz,v . This portion is typically a straight line segment entering v. If
this portion needs to have one or two bends in plane pz,v , then the routing is
done without (a) crossing portions of other edges lying in pz,v , and (b) blocking
v’s free directions that may be used in the future (see Same-Plane Route and
Routing Case 3).
If there is a portion of the third stage lying in px,v or py,v , then it does not
cross line segments of other edges that are perpendicular to pz,v since neither
px,v nor py,v can be used to route edges that are not incident to v. The only
exception to this would be the case where there was a vertex w so that v was
placed directly to the top of w. But in that case, w would have degree 6 that is
no future incoming vertices will be adjacent to it.
If there is a portion s of the third stage lying in px,u or py,u , then we
distinguish two cases: In the first case, edge e leaves u from its top free direction.
The portion of any future edge (u, v0 ) which is perpendicular to pz,v will lie
outside the current drawing, so it cannot cross s. In the second case, edge e
leaves u from one of its plane free directions (in other words, we have Routing
Case 3). In this case, u’s top free direction was used in the past to route some
other edge e0 . The whole route of e0 lies entirely below v, so no portion of this
route can cross s. Hence we have:
Lemma 1 Our routing technique for 3-D orthogonal graph drawing guarantees
that each edge has at most three bends and no two edges cross (in a current
drawing).
In order to measure the volume of the current 3-D drawing at time t, we
count the total number of planes that were inserted in the drawing up to time
t. Placing v and routing edge (ua , v) requires two or three new planes. Routing
any other edge (ui , v) (where ui is not the cover) adds at most one new plane.
Routing edge (uc , v) requires one or two new planes. However, whenever two
new planes are required to route edge (uc , v), placing v and routing edge (ua , v)
requires only two new planes (see Routing Case 3).
From this it follows that if v’s local degree is l ≥ 1, then at most l + 2 new
planes need to be inserted when v is placed in the current drawing. Vertex
v2 (i.e., the second vertex to be inserted in the drawing) is the only exception
and requires four new planes, although it has local degree 1 (see Fig. 2a). Let
n1 (t), n2 (t), n3 (t), n4 (t), n5 (t), n6 (t) be the total number of vertices with local
degree 1, 2, 3, 4, 5, 6, respectively, and n(t) be the total number of vertices of
the current drawing at time t. Also recall that v1 (i.e., the first vertex to be
inserted) introduces three planes. If P (t) is the total number of planes inserted
in the drawing at time t, then we have:
P (t) ≤ 3 + 3n1 (t) + 1 + 4n2 (t) + 5n3 (t) + 6n4 (t) + 7n5 (t) + 8n6 (t)
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 96
≤ (n1 (t) + 2n2 (t) + 3n3 (t) + 4n4 (t) + 5n5 (t) + 6n6 (t))
+(2n1 (t) + 2n2 (t) + 2n3 (t) + 2n4 (t) + 2n5 (t) + 2n6 (t)) + 4
≤ 3n(t) + 2(n(t) − 1) + 4
≤ 5n(t) + 2.
Let Px (t), Py (t), Pz (t) be the total number of planes perpendicular to the x, y, z-
axes, respectively, inserted in the current drawing up to time t, so that Px (t) +
Py (t) + Pz (t) = P (t). The volume V (t) of the current drawing at time t is:
V (t) = (Px (t) − 1) × (Py (t) − 1) × (Pz (t) − 1), and it is maximized when:
Px(t) = Py (t) = Pz (t) = P 3(t) = 5n(t)+2 3 . From this it follows that V (t) ≤
5n(t)+2 3 5n(t) 3 3
( 3 − 1) ≤ ( 3 ) ≈ 4.63n (t).
Clearly, each edge route has a constant number of bends and each vertex
insertion requires a constant number of planes to be added to the current draw-
ing. However, in order to guarantee constant time when a plane is inserted at
a particular position in the middle of the current drawing, we have to use the
data structure by Dietz and Sleator [9]. A vertex insertion can be completed in
constant time as long as the system does not have to produce the new drawing.
If a drawing is required, then the time is linear per vertex insertion operation.
From the above discussion and Lemma 1 we have:
6
4
numbered vertex. What the above condition means is that the resulting directed
graph has one source and at least one sink. A simple Depth-First-Search (DFS
[14]) or Breadth-First-Search (BFS [14]) can provide such a numbering for any
connected graph. Hence we have the following:
(a) (b)
Figure 6: (a) Every box has six rectangular sides, (b) front side connectors of a
box.
d2
d3
d1
(a) (b)
Figure 7: (a) Increasing the length of a box towards the (a) right or (b) left
direction creates new connectors.
c ’i c ’i
c’
j
c ’j
v
xz-plane
xz-plane
(a) (b)
Figure 8: (a) Choosing the median points along x and z-axes, (b) projection of
v’s position and connectors on xz-plane.
distance of one unit from that. If c0j is the projection of connector cj located on
the back side of box uj , we insert a new plane pj in the 3-D drawing parallel to
the bottom side of uj at a distance of one unit from that.
The three planes p0 , pi and pj intersect at a single point. This is the point
where the connector shared by the top, right and front sides of box v is going
to be placed. Notice that the exact coordinates of a specific connector of box v
determine the location of v. We open up new planes (if required) in the middle
of the drawing to accommodate the size of v. Figure 8b shows the relative
position of v and the 11 projection points of the example of Fig. 8a. Note that
Fig. 8b is the projection of that portion of the 3-D drawing on the xz-plane.
Notice that there are no two points (with at most one of them belonging to
box v) sharing the same row or column in the xz-plane (i.e., no-common-plane
property).
Similarly, we compute the coordinates of a newly inserted box v in the cases
where all connectors c1 , c2 , · · · ck lie on the top, bottom, front, right or left sides
of v’s adjacent vertices. From the above discussion regarding the position where
a new vertex is inserted, we have the following three propositions:
Proposition 5.1 At any time t, the 3-D drawing has the no-common-plane
property, that is there is no plane parallel to one of the three base planes con-
taining two connectors of two different boxes.
connectors lie on the ‘same’ side of their boxes (i.e., they are all either on the
top, bottom, right, left, front, or back sides of their boxes).
Proposition 5.3 Consider the case of placing a new vertex v with local degree
k, so that the edges connecting v with its adjacent vertices attach to the back
sides of the boxes of the adjacent vertices. Compute the projections of v and the
connectors of the adjacent boxes where the edges attach, on the xz-plane. The
following hold:
• there are d k2 e (b k2 c) projection points lying strictly above (below) v’s top
(bottom) side,
• there are d k2 e (b k2 c) projection points lying strictly to the right (left) of v’s
right (left) side.
This generalizes accordingly depending on the way the new vertex v is placed in
the 3-D drawing.
bi b’i bi
v cv
ei b’i
cv v ei
c c
i
i
(a) (b)
Figure 9: Routing edges to the top side of box v when ci is to the (a) left and
(b) right of v.
draw a straight line between b0i and connector cv . The full route is depicted in
Fig. 9a. Observe that it follows the orthogonal paradigm. Also, edge ei has
exactly two bends, one at point bi and one at point b0i .
Connector cv of v is picked so that line segment bi b0i does not block the top
free direction of any other connector of v (see Fig. 9a). Also, if it turns out
that there is a connector c0i of box ui whose back free direction is blocked by
line segment bi b0i , then we use c0i as the other endpoint of edge ei instead of ci .
The edges that start from the remaining outleft connectors are routed in a
similar fashion, that is with exactly two bends per route. The edges that start
from the outright connectors are routed to connectors of the top side of box v
that are still available, and the routing is done in the way described above. If
there are still outright connectors whose edges have not been routed, then these
edges are routed to connectors of the right side of v. In Fig. 9b we show an
example of the routing of such an edge. Notice that the routing can still be done
with two bends, and the line between the two bends is parallel to the z-axis.
If there are fewer outright than outleft connectors, then we first route the
edges of the outright connectors to the top side of v, and then the edges of the
outleft connectors to the top and (if necessary) left side of v. In either case,
from Proposition 5.3 and the fact that v’s local degree is at most 16, it follows
that routing the edges of all the outleft and outright connectors requires at most
two sides of v.
So far in this subsection we have discussed how to route edges that come from
outleft and outright connectors with z-coordinates greater than the z-coordinate
of any point on v’s top side. We follow a similar procedure to route the edges
coming from connectors whose z-coordinates are lower than the z-coordinate of
any point on v’s bottom side. This means that we first split these connectors
into outleft and outright ones, find which one of the two sets has the smallest
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)105
cardinality, and then route the individual edges using the connectors lying on
the other two sides of v.
After the end of the routing of all incident edges of v, the insertion operation
of v is complete. We used a specific situation for the position of v in order to
describe our edge routing technique. It is easy to generalize this technique to
any other case of box positioning in the 3-D drawing, as long as the principles
and properties described in the following routing lemma are maintained:
cr
e’ cr
e e’
e
u v
p
(a) (b)
Figure 10: Crossings occurring when e blocks the free direction of other con-
nectors.
The middle leg of edge e lies completely outside the current drawing. Because
of this, it does not cross a leg of any other edge of the current drawing. Also,
since the middle leg of edge e does not block the free direction of any connector
of boxes u and v, crossing situations similar to the ones shown in Fig. 10 cannot
happen. Figure 10a shows a situation where e blocks the back free direction of
some connector of u, and Fig. 10b shows a situation where e blocks the top free
direction of some connector of v. If a future edge e0 uses these connectors, then
e and e0 will cross at point cr . Therefore we have:
Lemma 3 There are no edge crossings in any 3-D orthogonal drawing produced
using the techniques for vertex placement and edge routing described in the pre-
vious sections.
We have assumed that every time a new vertex is inserted, its local degree
is at most 16. Since this is the case, every vertex is represented by a 1 × 1 × 1
box the moment it is placed in the drawing. Clearly, when a new box is placed,
we open up two new planes parallel to each one of the three base planes. In
other words, each of the length, width, and height of the drawing increases by
two units.
When a new box is placed, we may have to grow the boxes of some adjacent
vertices. We insert a new plane in the drawing when we grow a box. In the worst
case, we have to grow the boxes of all adjacent vertices of each vertex inserted
in the drawing up to time t. Assume that dloc is the local degree of some newly
inserted vertex, so that dloc ≤ 16. Let l, w and h be the numbers of new planes
we open up as a result of vertex growth, parallel to the yz-plane, xz-plane, and
xy-plane, respectively. In the worst case we have that: l + w + h = dloc .
Proof. From the description of edge routing in Section 5.2 and Lemma 2 we
have that every edge in the drawing has two bends. From Lemma 3 it follows
that no two edges cross at any time t during the drawing process.
For every box v in the drawing, v’s incident edges attach to connectors
located on the sides of the box. Box v grows only when there are no available
connectors on the side of v where one of v’s incident edges needs to attach. The
worst case happens when v’s incident edges always attach to the same side of
v; let sv be this side. Also, let t be the current time and degt (v) be the current
degree of v. The surface of side sv is at most degt (v), and the total surface of
all sides of v is at most 6 × degt (v).
We saw above that the volume of the 3-D orthogonal drawing after the
insertion of a vertex v is at most (r + dloc3(v) + 2)3 , where r 3 is the volume
before the insertion and dloc (v) is v’s local degree. Let m(t) be the number
of edges in the drawing at time t and G(t) be the underlying graph. It holds
P dloc (v)
that: v∈G(t) 3
= m(t)
3
. Hence, we obtain the upper bound shown in the
theorem for the volume of the drawing.
Let v be the next vertex to be inserted into the current drawing. Creating a
box for v and placing v takes constant time. At most dloc (v) other boxes of the
current drawing need to grow and exactly dloc (v) edges are routed as a result of
v’s insertion. Growing a box and routing an edge takes constant time, therefore
v’s insertion takes O(dloc (v)) time. Since dloc (v) ≤ 16, this time is constant. 2
In practice, we expect the volume to be smaller than the upper bound given
in the above theorem. This is because our analysis assumed that for each vertex
insertion the boxes of all the adjacent vertices had to grow. We expect a box
to grow very infrequently, since each box has several connectors on its sides.
If da (t) is the average vertex degree of the graph represented
P by the drawing
degt (v)
at time t, we have that da(t) is given by: da (t) = v
n(t) = 2m(t)
n(t) , where
degt (v) is the degree of vertex v at time t. Another expression for the volume
of the drawing is given by the following corollary:
Corollary 5.1 If the average vertex degree at time t is da (t), then a 3-D orthog-
onal drawing produced by our algorithm has volume ( da (t)+12
6 n(t))3 , in addition
to the properties discussed in Theorem 3.
It is worth noting that, in terms of volume, the performance of this algorithm
for graphs of average degree 6, is the same or better than the one of the algorithm
in [13]. For example, if the average vertex degree is 6, the volume of the drawing
is at most (3n)3 , which is the same as the exact volume required by the algorithm
in [13] for 3-D orthogonal graph drawing. However, the drawing approach of
[13] represents vertices with points, handles only vertices of degree at most 6,
allows three bends per edge, and requires that the whole graph be known in
advance.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)109
The algorithm for 3-D orthogonal graph drawing and the analysis we pre-
sented in this section apply to the case of a non-interactive setting as well. In
this case, the whole graph is known ahead of time. Our algorithm produces a
3-D orthogonal drawing of the graph in O(m) time (m is the number of edges in
the graph), as long as it is supplied with any vertex numbering. This numbering
determines the order of vertex placement. Figure 11 shows the 3-D orthogonal
drawing of K5 as produced by our algorithm. The box numbers denote the
vertex insertion order.
5
3
If we allow the insertion of a vertex v having local degree higher than 16,
then the only thing that changes in the above algorithm is the size of the box
representing v. Recall that a new box placed in the current drawing is always
of cubic configuration. In addition to that, its incident edges attach to at most
four of its six sides. A 2 × 2 × 2 cube has nine connectors on each side and
can represent a vertex with local degree at most 36. Similarly, a 3 × 3 × 3 cube
has 16 connectors on each side and can represent a vertex with local degree at
most 64. In this way, we can accommodate the insertion of a vertex of any local
degree.
The insertion of a 2×2 ×2 box requires opening up three new planes parallel
to each one of the base planes (nine new planes total). Similarly, the insertion
of an r × r × r box requires opening up r + 1 new planes parallel to each one
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)110
of the base planes (3(r + 1) new planes total). From the volume analysis we
presented in this subsection, we have that the general formula for the volume
3
3 + 2n1..16 + 3n17..36 + · · · + rn4(r−1) +1..4r + · · ·) , where ni..j is the
is: V ≤ ( m 2 2
number of vertices in the current drawing at time t with local degrees in the
range from i to j.
1.6e+06
1.4e+06
1.2e+06
1e+06
Volume
800000
600000
400000
200000
0
0 10 20 30 40 50 60 70 80 90 100
Nodes
(a)
2.5
2.45
Average Bends per Edge
2.4
2.35
2.3
2.25
2.2
0 10 20 30 40 50 60 70 80 90 100
Nodes
(b)
Figure 12: Graphs of the experimental findings: (a) volume; (b) bends.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)112
100
90
80
Average Edge Length
70
60
50
40
30
20
10
0
0 10 20 30 40 50 60 70 80 90 100
Nodes
Acknowledgements
We would like to thank Maurizio “Titto” Patrignani for sharing with us the
valuable experimental results of his implementation of our algorithm; also, we
would like to thank Janet Six for useful discussions, and the referees for their
thorough reading of the paper and their useful comments that improved the
presentation of the algorithms.
References
[1] H. Alt, M. Godau, S. Whitesides, Universal 3-Dimensional Visibility Rep-
resentations for Graphs, Comput. Geom. Theory Appl., 9:111-125, 1998.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)113
[2] T. Biedl and G. Kant, A Better Heuristic for Orthogonal Graph Drawings,
Proc. 2nd Ann. European Symposium on Algorithms (ESA ’94), Lecture
Notes in Computer Science, vol. 855, pp. 24-35, Springer-Verlag, 1994.
[3] P. Bose, H. Everett, S. Fekete, M. Houle, A. Lubiw, H. Meijer, K. Romanik,
G. Rote, T. Shermer, S. Whitesides, and C. Zelle. A visibility representation
for graphs in three dimensions, J. Graph Algorithms Appl., 2:1-16, 1998.
[4] M. Brown and M. Najork, Algorithm animation using 3D interactive graph-
ics, Proc. ACM Symp. on User Interface Software and Technology, 1993,
pp. 93-100.
[5] I. Bruß and A. Frick, Fast Interactive 3-D Visualization, Proc. of Workshop
GD ’95, Lecture Notes in Comp. Sci. 1027, Springer-Verlag, 1995, pp. 99-
110.
[6] M. Chrobak, M. Goodrich, and R. Tamassia, Convex drawings of graphs in
two and three dimensions, Proc. 12th Annual ACM Symposium on Com-
putational Geometry, 1996, pp. 319-328.
[7] R. Cohen, P. Eades, T. Lin, F. Ruskey, Three Dimensional Graph Drawing,
Algorithmica, 17:199-208, 1997.
[8] I. Cruz and J. Twarog, 3D Graph Drawing with Simulated Annealing, Proc.
of Workshop GD ’95, Lecture Notes in Comp. Sci. 1027, Springer-Verlag,
1995, pp. 162-165.
[9] P. F. Dietz and D. D. Sleator, Two algorithms for maintaining order in
a list, Proc. 19th Annual ACM Symp. Theory of Computing, 1987, pp.
365-372.
[10] G. Di Battista, P. Eades, R. Tamassia and I. G. Tollis, Graph Drawing,
Prentice Hall, 1999.
[11] D. Dodson, A Tool for Information Visualization using Co-operative 3D
Diagram Layout, Proc. of Workshop GD ’95, Lecture Notes in Comp. Sci.
1027, Springer-Verlag, 1995, pp. 190-201.
[12] P. Eades, C. Stirk, S. Whitesides, The Techniques of Kolmogorov and
Bardzin for Three Dimensional Orthogonal Graph Drawings, Information
Processing Letters, 60:97-103, 1996.
[13] P. Eades, A. Symvonis, S. Whitesides, Two Algorithms for Three Dimen-
sional Orthogonal Graph Drawing, Proc. of GD ’96, Lecture Notes in Comp.
Sci. 1190, Springer-Verlag, 1996, pp. 139-154.
[14] S. Even, Graph Algorithms, Computer Science Press, 1979.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)114
[15] S. Even and G. Granot, Grid Layouts of Block Diagrams — Bounding the
Number of Bends in Each Connection Proc. DIMACS Workshop GD ’94,
Lecture Notes in Comp. Sci. 894, Springer-Verlag, 1994, pp. 64-75.
[16] S. Fekete, M. Houle, S. Whitesides, New Results on a Visibility Representa-
tion of Graphs in 3D, Proc. of Workshop GD ’95, Lecture Notes in Comp.
Sci. 1027, Springer-Verlag, 1995, pp. 234-241.
[17] A. Garg and R. Tamassia, GIOTTO3D: A System for Visualizing Hierar-
chical Structures in 3D, Proc. of GD ’96, Lecture Notes in Comp. Sci. 1190,
Springer-Verlag, 1996, pp. 193-200.
[18] A. Garg, R. Tamassia, and P. Vocca, Drawing with colors, Proc. 4th Annual
European Symposium on Algorithms (ESA ’96), Lecture Notes Comp. Sci.
1136, Springer-Verlag, 1996, pp. 12-26.
[19] T. Kamada and S. Kawai, An algorithm for drawing general undirected
graphs, Inf. Proc. Letters 31, (1989), 7-15.
[20] G. Kant, Drawing Planar Graphs Using the Canonical Ordering, Algorith-
mica, vol. 16, no. 1, 1996, pp. 4-32.
[21] A. N. Kolmogorov and Y. M. Bardzin, About Realization of Sets in 3-
dimensional Space, Problems in Cybernetics, 1967, pp. 261-268.
[22] J. MacKinley, G. Robertson, S. Card, Cone Trees: Animated 3d visual-
izations of hierarchical information, In Proc. of SIGCHI Conf. on Human
Factors in Computing, pp. 189-194, 1991.
[23] A. Papakostas and I. G. Tollis, Improved Algorithms and Bounds for Or-
thogonal Drawings, Proc. DIMACS Workshop GD ’94, Lecture Notes in
Comp. Sci. 894, Springer-Verlag, 1994, pp. 40-51.
[24] A. Papakostas and I. G. Tollis, Algorithms for Area-Efficient Orthogonal
Drawings, Computational Geometry Theory and Applications, 9 (1998),
83-110.
[25] A. Papakostas and I. G. Tollis, Issues in Interactive Orthogonal Graph
Drawing, Proc. of Workshop GD ’95, Lecture Notes in Comp. Sci. 1027,
Springer-Verlag, 1995, pp. 419-430.
[26] A. Papakostas and I. G. Tollis, Interactive Orthogonal Graph Drawing,
IEEE Transactions on Computers, vol. 47, no. 11 November 1998, pp. 1297-
1309.
[27] A. Papakostas and I. G. Tollis, A Pairing Technique for Area-Efficient
Orthogonal Drawings, Proc. of GD ’96, Lecture Notes in Comp. Sci. 1190,
Springer-Verlag, 1996, pp. 355-370.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)115
[37] O. Tversky, S. Snibbe, R. Zeleznik, Cone Trees in the UGA graphics system:
Suggestions of a more robust visualization tool, Technical Report CS-93-07,
Brown University.
[38] C. Ware, D. Hui, G. Frank, Visualizing object oriented software in 3 di-
mensions, in Proc. CASCON, 1993.