Download as pdf or txt
Download as pdf or txt
You are on page 1of 181

Journal of Graph Algorithms and Applications

http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 1, pp. 1–18 (1999)

Edge-Coloring and f -Coloring for Various


Classes of Graphs
Xiao Zhou
Graduate School of Information Sciences
Tohoku University
Aoba-yama 05, Sendai 980-8579, Japan
zhou@ecei.tohoku.ac.jp

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.

Communicated by M. Kaufmann: submitted October 1997; revised September 14, 1998.


X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 2

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

Concerning parallel edge-coloring algorithms, NC parallel exact algorithms have


been obtained only for a few restricted classes of graphs such as bipartite graphs
[20], series-parallel simple graphs [2], series-parallel multigraphs [35], partial k-
trees [32] and planar graphs with maximum degree ∆ ≥ 9 [3, 4]. However, NC
parallel approximate algorithms to edge-color G with ∆+ 1 colors have not been
known so far except for the case when ∆ is small [18]. On the other hand, no
efficient exact algorithms for the f -coloring problem have been obtained even
for restricted classes of graphs.
In this paper we consider various classes of graphs specified by invariants
like the degeneracy. The degeneracy s(G) of a graph G is the minimum number
s such that G can be reduced to an empty graph by the successive deletion of
vertices with degree at most s [1]. Clearly the degeneracy has a favorable impli-
cation on the vertex-coloring: any graph G can be vertex-colored with at most
s(G) + 1 colors [9, 22, 23, 28]. On the other hand, Vizing [16, 31] showed that
the degeneracy has a surprising implication on the edge-coloring: χ0 (G) = ∆(G)
if ∆(G) ≥ 2s(G). Thus Vizing gave a lower bound on ∆(G) for χ0 (G) = ∆(G)
to hold true. In this paper we express such a lower bound in terms of vari-
ous other graph-invariants like tree-width, arboricity, unicyclic index, thickness,
and genus. It is rather straightforward to derive from Vizing’s proof an O(mn)
algorithm for edge-coloring a graph G with ∆(G) colors if ∆(G) ≥ 2s(G). We
give more efficient sequential and NC parallel algorithms to edge-color a graph
G whose maximum degree ∆(G) is roughly larger than twice the lower bounds,
say ∆(G) ≥ 4s(G). Our sequential algorithm takes time O(n log n) if s(G) is
bounded and ∆(G) ≥ 4s(G). We next give a simple but useful transformation
of a graph G to a new graph Gf such that an ordinary edge-coloring of Gf
immediately induces an f -coloring of the original graph G with the same num-
ber of colors. Using the transformation, we finally give efficient sequential and
NC parallel algorithms to f -color various classes of graphs with large ∆(G). In
the paper the parallel computation model we use is a concurrent-read exclusive-
write parallel random access machine (CREW PRAM). An early version of the
paper was presented at [33].

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

We then define various invariants of graphs. Let s be a positive integer. A


graph G is s-degenerate if the vertices of G can be ordered v1 , v2 , · · ·, vn so
that d(vi , Gi ) ≤ s for each i, 1 ≤ i ≤ n, where Gi = G − {v1 , v2 , · · · , vi−1 }
[1, 9, 22, 23]. Thus G is s-degenerate if and only if G can be reduced to a
trivial graph by the successive removal of vertices having degree at most s. The
degeneracy s(G) of G is the minimum integer s for which G is s-degenerate. The
degeneracy s(G) is also called the Szekeres-Wilf number [28]. The degeneracy
of a graph can be computed in linear time [23]. Every planar graph G has a
vertex of degree at most five, that is, δ(G) ≤ 5 [1, 27], and hence

s(G) ≤ 5. (1)

Obviously any graph G can be vertex-colored with at most s(G) + 1 colors


[9, 22, 23, 28]. Vizing showed that χ0 (G) = ∆(G) if ∆(G) ≥ 2s(G) [16, 31].
A graph G = (V, E) is a k-tree if either it is a complete graph on k vertices
or it has a vertex v ∈ V whose neighbors induce a clique of size k and G − {v} is
again a k-tree. A graph is a partial k-tree if it is a subgraph of a k-tree [32]. The
tree-width k(G) of graph G is the minimum integer k such that G is a partial
k-tree. Clearly
s(G) ≤ k(G). (2)
The arboricity a(G) of a graph G is the minimum number of edge-disjoint
forests into which G can be decomposed. Nash-Williams [26] proved that a(G) =
maxH⊆G dm(H)/(n(H) − 1)e, where H runs over all nontrivial subgraphs of G.
We have
a(G) ≤ s(G), (3)
because any subgraph H of G is s(G)-degenerate and hence m(H) ≤ s(G)(n(H)
−1) and m(H)/(n(H) − 1) ≤ s(G). Furthermore, if G is planar, then

a(G) ≤ 3, (4)

because m(H) ≤ 3n(H) − 3 for any nontrivial subgraph H of G.


We now introduce a rather unfamiliar invariant a0 (G) which we call the
unicyclic index of a graph G: a0 (G) is the minimum number of edge-disjoint
unicyclic graphs, that is, graphs with at most one cycle, into which G can be
decomposed. Since a forest is a unicyclic graph and a unicyclic graph can be
decomposed to one or two forests, we have

a0 (G) ≤ a(G) ≤ 2a0 (G). (5)

The thickness θ(G) of a graph G is the minimum number of edge-disjoint


planar subgraphs into which G can be decomposed. Clearly

θ(G) ≤ a0 (G) ≤ a(G) ≤ 3θ(G) (6)

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)

Furthermore any subgraph H of G satisfies g(H) ≤ g(G). Therefore, if g(G) ≥ 1


then j p  k
s(G) ≤ 5 + 48g(G) + 1 /2 . (8)

One can observe that the following upper bound holds on the minimum
degree.

Lemma 1 The following (a)–(c) hold for any nontrivial graph G:

(a) δ(G) ≤ 2a(G) − 1 [8];


(b) δ(G) ≤ 2a0 (G); and
(c) if a0 (G) is bounded and U = {u ∈ V | d(u, G) ≤ 2a0 (G)}, then |U | ≥
n/(2a0 (G) + 1) and hence |U | = Θ(n).

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.

Lemma 2 The following (a) – (f) hold:


(a) s(G) ≤ k(G);
(b) s(G) ≤ 2a(G) − 1;
(c) s(G) ≤ 2a0 (G);
(d) s(G) ≤ j
6θ(G) − 1;  k
p
(e) s(G) ≤ 5 + 48g(G) + 1 /2 if g(G) ≥ 1; and
(f) s(G) ≤ 5 if G is planar.

The relationships among these graph-invariants are illustrated in Figure 1.


X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 6

p 
k(G) O g(G)
2a(G) − 1 2a0 (G) 
hhhh
hhhQ 
s(G)
3θ(G)
hhhh
hh
a(G)

a0 (G)

θ(G)

Figure 1: Relationships among graph-invariants.

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

Theorem 2 [31] χ0 (G) = ∆(G) if ∆(G) ≥ 2s(G).

Proof: Assume that G is a nontrivial graph with ∆(G) ≥ 2s(G). Then by


Theorem 1 G has an eliminable edge e1 . Let G1 = G − {e1}, then s(G1 ) ≤ s(G).
If ∆(G1 ) = ∆(G), then G1 has an eliminable edge e2 . Thus there exists a
sequence of edges e1 , e2 , · · · , ej such that

(i) ∆(Gj ) = ∆(G) − 1 where Gj = G − {e1 , e2 , · · · , ej }; and


(ii) every edge ei , 1 ≤ i ≤ j, is eliminable in Gi−1 = G − {e1 , e2 , · · · , ei−1 }.

By the classical Vizing’s theorem [10], χ0 (Gj ) ≤ ∆(Gj ) + 1 = ∆(G). Therefore,


applying Lemma 3 repeatedly, we have χ0 (G) = ∆(G). 2
A minor of a graph G is a graph obtained from G by repeated deletions and
contractions of edges. We say that a class G of graphs is minor closed if any
minor of G belongs to G for every graph G ∈ G. A classical result of Mader
[7, 21] implies that every graph G in any minor closed class G has a degeneracy
bounded by a constant h(G), that is, s(G) ≤ h(G), where h(G) is a constant
depending on the class G. For example, h(G) = 5 for the class G of planar
graphs.
Thus we have the following corollary from Theorem 2 and Lemma 2.

Corollary 1 χ0 (G) = ∆(G) if one of the following (a) – (g) holds:


(a) G belongs to a minor closed class G and ∆(G) ≥ 2h(G);
(b) ∆(G) ≥ 2k(G) [32];
(c) ∆(G) ≥ 4a(G) − 2;
(d) ∆(G) ≥ 4a0 (G);
(e) ∆(G) ≥ 12θ(G) − 2;
j p  k
(f) g(G) ≥ 1 and ∆(G) ≥ 2 5 + 48g(G) + 1 /2 ; and

(g) G is planar and ∆(G) ≥ 10.

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

(g) G is planar and ∆(G) ≥ 12.


Zhou et al. [32] obtained a result stronger than Corollary 2(d): a linear-time
sequential and an optimal parallel edge-coloring algorithm for any graphs with
bounded k(G), i.e., partial k-trees.
In the remaining of this section we prove Theorem 3. We use Chrobak and
Nishizeki’s algorithm [3] which edge-colors a planar graph G of ∆(G) ≥ 9 by ∆
colors in O(n log n) sequential time or in O(log3 n) parallel time with O(n log3 n)
operations and hence is stronger than Corollary 2(g). Their algorithm relies on
the following fact: any planar connected graph G has Θ(n) eliminable edges if
∆(G) ≥ 9 [3]. We have the following lemma on graphs which are not always
planar.
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 9

Lemma 4 If G is a connected graph, ∆(G) is bounded and ∆(G) ≥ 4a0 (G),


then G has Θ(n) eliminable edges.
Proof: Let U = {u ∈ V (G) | d(u, G) ≤ 2a0 (G)}, then U 6= φ because by
Lemma 1(b) δ(G) ≤ 2a0 (G). Furthermore V − U 6= φ since ∆(G) ≥ 4a0 (G) >
2a0 (G). Therefore the graph H obtained from G by deleting all the vertices in
U is not empty. Let W = {w ∈ V (H) | d(w, H) ≤ 2a0 (G)}, and let E 0 be the
set of edges (u, v) ∈ E(G) such that u ∈ U and v ∈ U ∪ W . Then it suffices to
prove the following (i) and (ii):
(i) each edge (u, v) ∈ E 0 is eliminable; and
(ii) the number of edges in E 0 is Θ(n).
We first prove (i). Let (u, v) be an arbitrary edge in E 0 . Since u ∈ U ,
d(u) ≤ 2a0 (G) < ∆. On the other hand d∗u (v) ≤ 2a0 (G): if v ∈ U then
d∗u (v) ≤ d(v, G) ≤ 2a0 (G); and if v ∈ W then d∗u (v) ≤ d(v, H) ≤ 2a0 (G) since
none of v’s neighbors in U has degree ∆. Therefore d(u) + d∗u (v) ≤ 4a0 (G) ≤ ∆,
and hence edge (u, v) is eliminable.
We next prove (ii). Since at least one edge in E 0 is incident to each vertex
in W , we have
|E 0 | ≥ |W |. (9)
By applying Lemma 1(c) to graph H we have
n(H)
|W | ≥ . (10)
2a0 (H) + 1
Since a0 (H) ≤ a0 (G) and n(H) = n − |U |, we have
n − |U |
|W | ≥ . (11)
2a0 (G) + 1
2∆−1
If |U | is small, say |U | ≤ 2∆+1 n, then by Eqs. (9) and (11) we have
1
|E 0 | ≥ (n − |U |)
2a0 (G) + 1
2
≥ 0
n,
(2a (G) + 1)(2∆ + 1)
and hence |E 0 | = Θ(n) since both ∆(G) and a0 (G) are bounded. Thus it suffices
to verify |E 0 | = Θ(n) for the case when |U | > 2∆−1
2∆+1 n, that is,

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

Since G is connected, m ≥ n − 1. Therefore by Eqs. (11), (12) and (13) we have


∆ − a0 (G)
|E 0 | ≥ n − 1 − ∆(n − |U |) + (n − |U |)
2a0 (G) + 1
a0 (G)(2∆ + 1)
= n−1− (n − |U |)
2a0 (G) + 1
2a0 (G)
> n−1− 0 n
2a (G) + 1
1
= 0
n − 1.
2a (G) + 1
Thus |E 0 | = Θ(n) since a0 (G) is bounded. 2
Lemma 4 implies that if G is a connected planar graph, ∆(G) is bounded and
∆(G) ≥ 12 then G has Θ(n) eliminable edges. Thus Lemma 4 does not implies
the fact proved by Chrobak and Nishizeki [3], but is a kind of generalization of
the fact for (not always planar) graphs.
Chrobak and Nishizeki’s algorithm [3] correctly edge-colors any (not always
planar) graph G with ∆ colors if ∆ is bounded and G has Θ(n) eliminable edges.
Therefore by Lemma 4 we have the following lemma.

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.

By Lemma 5, in order to prove Theorem 3, it suffices to give an algorithm


to edge-color G with ∆ colors only for the case in which ∆ is not bounded, say
∆ ≥ 8s(G)(> 4a0 (G)). Chrobak and Nishizeki’s algorithm [3] uses Chrobak and
Yung’s algorithm [4] for the case in which ∆ is large, say ∆ ≥ 19. However,
the algorithm in [4] works only for planar graphs with ∆ ≥ 19. Our idea
is to decompose (not always planar) graph G of large maximum degree into
several edge-disjoint subgraphs G1 , G2 , · · · , Gj of small maximum degrees ∆(Gi )
Pj 0
such that ∆(G) = i=1 ∆(Gi ) and 4s(G) ≤ χ (Gi ) = ∆(Gi ) < 8s(G) for
each i, and hence an edge-coloring of G with ∆(G) colors can be obtained
simply by superimposing edge-colorings of Gi with ∆(Gi ) colors. Note that the
edge-coloring of Gi can be found within the required time bounds as shown in
Lemma 5 since ∆(Gi ) is bounded.
Let c be a bounded positive integer, and let E1 , E2 , · · · , Ej be a partition
of E. Denote by Gi = G[Ei ] the subgraph of G induced by the edge set Ei .
We say that E1 , E2 , · · · , Ej is a (∆, c)-partition of E if Gi = G[Ei ], 1 ≤ i ≤ j,
satisfies
Pj
(i) ∆(G) = i=1 ∆(Gi ); and
(ii) ∆(Gi ) = c for each i, 1 ≤ i ≤ j − 1, and c ≤ ∆(Gj ) < 2c.
Clearly s(Gi ) ≤ s(G) for each i, 1 ≤ i ≤ j. Theorem 2 implies that χ0 (G) =
∆(G) since ∆(G) ≥ 8s(G) > 2s(G). Choose c = 4s(G), then ∆(Gi ) ≥ c =
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 11

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-colorings of Gi with ∆(Gi ) colors, 1 ≤ i ≤ j, can be immediately superim-


posed to an edge-coloring of G with ∆(G) colors. Zhou et al. [32] obtained the
following result on the (∆, c)-partition.

Lemma 6 If ∆(G) ≥ 2c ≥ 8s(G), then a (∆, c)-partition of E can be found in


linear sequential time or in O(log n) parallel time with O(n) operations.

Thus we have the following algorithm to edge-color a graph G such that


a0 (G) is bounded and ∆(G) ≥ 4a0 (G).

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;

We are now ready to prove Theorem 3.

Proof of Theorem 3: By Lemmas 5 and 6 clearly the algorithm above cor-


rectly finds an edge-coloring of a graph G with ∆ colors. Therefore it suffices
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 12

to prove the complexities. By Lemma 6 line 2 can be done in linear time


or optimally in parallel. By Lemma 5 line 1 can be done in O(n log n) se-
quential time or in O(log3 n) parallel time with O(n log3 n) operations, since
∆(G) < 8s(G) ≤ 16a0 (G) = O(1). At line 3, for each i, 1 ≤ i ≤ j, by Lemma 5
one can find an edge-coloring of Gi with ∆(Gi ) colors in O(n(Gi ) log n(Gi ))
sequential time or in O(log3 n(Gi )) parallel time with O(n(Gi ) log3 n(Gi )) op-
erations. Since Gi = G[Ei ], n(Gi ) ≤ 2|Ei |. Therefore
j
X j
X
n(Gi ) ≤ 2 |Ei | = 2|E|.
i=1 i=1

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

χ0f (G) ≤ χ0 (Gf ). (14)

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

Figure 2: Transformation from G to Gf .

The number of Pedges in Gf is equal to that of G, but the number of vertices


of Gf increases to v∈V f (v) (≤ 2m). Furthermore one can easily observe that
the following lemmas hold.

Lemma 7 For a graph G there exists Gf such that


(a) Gf is bipartite if G is bipartite;
(b) Gf is planar if G is planar;
(c) g(Gf ) ≤ g(G);
(d) s(Gf ) ≤ s(G);
(e) a(Gf ) ≤ a(G);
(f) a0 (Gf ) ≤ a0 (G); and
(g) θ(Gf ) ≤ θ(G).

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: (a) Let G be a graph in G. One can construct Gf from G in linear


time. Using the assumed algorithm, one can find an ordinary edge-coloring of
Gf with α∆(Gf )+ β colors in T (m(Gf )+ n(Gf )) time. The edge-coloring of Gf
immediately induces an f -coloring of G with α∆(Gf ) + β = α∆f (G) + β colors.
By the construction of Gf we have m(Gf ) = m(G) and n(Gf ) ≤ 2m(G) + n(G)
and hence m(Gf ) + n(Gf ) ≤ 3m(G) + n(G). Since the function T is polynomial,
T (m(Gf )+n(Gf )) = O(T (m(G)+n(G))). Thus an f -coloring of G can be found
in O(T (m(G) + n(G))) time in total.
(b) Similarly, Gf can be easily constructed from G in O(log(m(G) + n(G)))
parallel time with O(m(G) + n(G)) operations. 2
It is known that χ0 (G) = ∆(G) if G is a bipartite graph [19] and that
0
χ (G) = ∆(G) if G is a planar graph with ∆(G) ≥ 8 [10, 27]. Therefore, by
Theorem 2, Corollary 1 and Lemmas 7, 8, we have the following theorem.

Theorem 4 χ0f (G) = ∆f (G) if one of the following (a)–(i) holds:


(a) G belongs to a minor closed class G and ∆f (G) ≥ 2h(G);
(b) G is bipartite [13];
(c) ∆f (G) ≥ 2s(G);
(d) G is a partial k-tree and ∆f (G) ≥ 2k;
(e) ∆f (G) ≥ 4a(G) − 2;
(f) ∆f (G) ≥ 4a0 (G);
(g) ∆f (G) ≥ 12θ(G) − 2; j  k
p
(h) g(G) ≥ 1 and ∆f (G) ≥ 2 5 + 48g(G) + 1 /2 ; and
(i) G is planar and ∆f (G) ≥ 8.

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

√ G can be f -colored by at most ∆f (G)+ 1 colors in O(min{m∆f


(a) Any graph
log n, m m log n}) time.

(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 }),

where mf is the number of edges and nf the number of vertices in Gf . Since


mf = O(m), nf = O(m + n) and ∆(Gf ) = ∆f (G), the claim holds.
(b) Gf is also bipartite. The algorithm in [6] edge-colors a bipartite graph
Gf with ∆(Gf ) colors in time O(mf log nf ). Thus the claim holds similarly as
(a).
j ≤ p
(c) Similar to (b). Note that s(G) h(G), a0 (G) ≤ k ≤ s(G) ≤ k(G),
 a(G)
a(G) ≤ 3θ(G), and a(G) ≤ s(G) ≤ 5 + 48g(G) + 1 /2 . 2

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

Proof: (a) Gf is also bipartite. The algorithm in [20] edge-colors Gf with


∆(Gf ) colors in O(log3 nf ) parallel time with O(mf ) operations. Since mf =
O(m), nf = O(m + n) and ∆(Gf ) = ∆f (G), the claim holds.
(b) Similar to (a). 2
It should be noted that the algorithms in Theorems 5.4 and 5.5 do not need
to know an actual embedding or a decomposition related to an invariant.

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

[7] R. Diestel. Graph Theory, Springer, New York, 1997.


[8] A.M. Dean and J.P. Hutchinson. Relations among embedding parameters
for graphs. In Graph Theory, Combinatorics, and Applications, (Eds.)
Y. Alavi, G. Chartrand, O.R. Ollermann, and A.J. schwenk. John Wiley
and Sons, 287–296, 1991.
[9] P. Erdös and A. Hajnal. On chromatic number of graphs and set-systems.
Acta. Math. Acad. Sci. Hungar., 17:61–99, 1966.
[10] S. Fiorini and R. J. Wilson. Edge-Colourings of Graphs. Pitman, London,
1977.
[11] H. N. Gabow and O. Kariv. Algorithms for edge-coloring bipartite graphs.
SIAM J. Comput., 11:117–129, 1982.
[12] H. N. Gabow, T. Nishizeki, O. Kariv, D. Leven, and O. Terada. Algorithms
for edge-coloring graphs. Technical Report TRECIS-8501, Tohoku Univ.,
1985.
[13] S. L. Hakimi and O. Kariv. On a generalization of edge-coloring in graphs.
Journal of Graph Theory, 10:139–154, 1986.
[14] P. J. Heawood. Map color theorems. Quart. J. Math., 24:332–338, 1890.
[15] I. Holyer. The NP-completeness of edge-colouring. SIAM J. Comput.,
10:718–720, 1981.
[16] T. Jensen and B. Toft. Graph Coloring Problems. John Wiley & Sons, New
York, 1995.
[17] P. C. Kainen. Some recent results in topolgical graph theory. In Proceedings
of the Captial Conference on Graph Theory and Combinatorics, Springer-
Verlag, Lecture Notes in Mathematics, volume 406, pages 76–200, 1974.
[18] H. J. Karloff and D. B. Shmoys. Efficient parallel algorithms for edge-
coloring problems. Journal of Algorithms, 8:39–52, 1987.
[19] D. König. Über graphen und iher anwendung auf determinantentheorie
und mengenlehre. Math. Ann., 77:453–465, 1916.
[20] G. F. Lev, N. Pippenger, and L. G. Valliant. A fast parallel algorithm for
routing in permutation networks. IEEE Transactions on Computers, C-30,
2:93–100, 1981.
[21] W. Mader. Homomorphieeigenschaften und mittlere Kantendichte von
Graphen. Math. Ann., 174, pp. 265–268, 1967.
[22] D. Matula. A min-max theorem for graphs with application to graph col-
oring. SIAM Rev., 10:481–482, 1968.
X. Zhou et al., Edge-Coloring and f -Coloring, JGAA, 3(1) 1–18 (1999) 18

[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)

Experimental Comparison of Graph Drawing


Algorithms for Cubic Graphs
Tiziana Calamoneri Simone Jannelli Rossella Petreschi
Dipartimento di Scienze dell’Informazione
Universitá di Roma “La Sapienza”
{ calamo,petreschi }@dsi.uniroma1.it

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.

Communicated by R. Tamassia: submitted May 1997; revised May 1999.

The first author is supported by the Italian Research Council – CNR.


T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 2

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)

Figure 1: Interaction between two particles.

Furthermore, cubic graphs have been widely studied by many researchers,


since they seem to be a threshold class of graphs, in the sense that they are
the simplest graphs for which several fundamental problems are as difficult as
in the general case [5, 14].
Several results on orthogonal drawing of cubic graphs have been presented
[2, 6, 7, 11, 17, 18, 19, 20, 22]. However, none of the cited papers provides exper-
imental results, although the interest in experimentally testing the performance
of graph drawing algorithms has increased in the last years [8, 9, 10, 15, 16].
This paper tries to bridge this gap by presenting an experimental comparison
of three orthogonal drawing algorithms for cubic graphs. The three selected al-
gorithms are as follows: the first one, by Biedl and Kant [2], is a specialization
of an algorithm for graphs with bounded degree 4; the second and third ones,
by Calamoneri and Petreschi [6] and by Papakostas and Tollis [19], respectively,
are specifically designed for cubic graphs.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 3

c
a

Figure 2: From a flowgraph to the underlying (undirected) cubic graph.

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.

Definition 1 Let G = (V, E) be a graph, n = |V | and m = |E|. An orthogonal


drawing of G is a drawing of G in the plane such that all edges are drawn as
sequences of horizontal and vertical segments. The edges are not allowed to
overlap for any distance (although a vertical segment may cross a horizontal
one). In addition, the edges cannot cross vertices that are not their extremes.
A point where the drawing of an edge changes its direction is called a bend of
this edge. This drawing is said to be a drawing in the (rectangular) grid if all
vertices and bends are at integer coordinates.

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.

Definition 2 Let k be a non negative integer. A k-bend drawing of a graph G


is a grid drawing of G in which every edge contains at most k bends.

Definition 3 [1] Let G be a connected graph. A vertex a is said to be an ar-


ticulation vertex of G if there exist vertices v and w such that v, w and a are
distinct, and every path between v and w contains vertex a. A connected graph
G is said to be biconnected if for every distinct triplet of vertices v, w, a, there
exists a path between v and w and not containing a. Thus, a connected graph is
biconnected if and only if it has no articulation vertex.

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

Figure 3: Transformation from biconnected at most cubic graph to cubic graph


and vice-versa.

graph, we can reinsert a vertex of degree 2 adjacent to vertices i and j by simply


placing a “dot” along the drawing of edge (i, j) (see Fig. 3).

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:

• g(u) 6= g(v) for u 6= v


• g(s) = 1
• g(t) = |V | = n
• for every v ∈ V − {s, t} there are vertices u and w such that g(u) < g(v) <
g(w) and {u, v}, {w, v} ∈ E.

From now on, we shall refer to the vertices of a biconnected st-numbered


cubic graph G = (V, E) by their st-numbers.

3 The Algorithms Under Evaluation


In order to make this paper self-contained, we shall briefly describe the three
algorithms we compare in the following and we will refer to them by means of
the first letters of their authors, i.e. BK[2], CP[6] and PT[19], respectively.
To make easier the reading of this section, we deal only with the key aspects
of the algorithms and we skip technical details. Furthermore, we present the
common characteristics and the differences between the algorithms.

• The input of these algorithms is a general simple loopless at most cubic


graph G (neither planarity nor 2- or 3-connectivity are required). Since
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 6

Figure 4: Insertion of vertex n in Algorithm PT.

Algorithm PT is presented in [19] only for biconnected graphs, in our com-


parisons we added to PT a second phase able to handle separated bicon-
nected components and to splice them. Namely, we utilize the procedure
detailed by Algorithm CP to assemble the biconnected components.
• In order to obtain better upper bounds for the optimization functions, the
algorithms do not guarantee the output to be plane even if the input is
planar. Actually, Algorithm BK has a behavior different from the other
two since it gets a plane drawing if a plane layout of G is given as input.
For the sake of uniformity, we have not considered this case.

• 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

Figure 5: Movement of a bend.

k j j

i i

Figure 6: Rotation of a vertex.

• 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

Figure 7: Insertion of vertices 1 and 2 in Algorithm BK.

Figure 8: A comb graph.

Finally, in Algorithm BK the addition of vertex n induces the drawing of


the last three edges dotted in the previous steps. Then, the insertion of n
and its edges induces a comb graph-like structure in which the teeth are
not connected to the n’s adjacent vertices but to their dotted edges.
• The second phase of the algorithms deals with general at most cubic graphs
and uses a decomposition into biconnected components.
The common idea is to draw separately each component and then to join
the drawings of the components through their connections. In this step,
both Algorithms BK and CP work in a recursive way, but they use differ-
ent methods. The main difference is that in BK the bridges (separating
edges) are removed, while in CP the articulation vertices are deleted.
This difference is reflected in the way the biconnected components are
later spliced together. Indeed, in BK only edges whose endpoints are al-
ready drawn must be added, but this requires that at least one of these
endpoints be on the boundary of the drawing of its biconnected compo-
nent. In CP the articulation vertices and their incident edges are added
and no constraint is required for their adjacent vertices. However, some
directions towards the boundary of the current drawing are always left
free (either directly, or after a movement of a bend, or after a rotation).

We conclude this section summarizing the worst-case theoretical results


achieved by the three algorithms.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 9

• Regarding the area of the drawing, for BK it is ( n2 + 2) × (n − 2) if the


input is biconnected and 34 n × 34 n otherwise. In CP and PT the area
is n2 × n2 and ( n2 + 1) × n2 , respectively, both for biconnected and simply
connected graphs.
• Regarding the total number of bends, Algorithm BK achieves n + 1 and n
for biconnected and simply connected graphs, respectively. In Algorithm
CP the bound is n2 + 1 in the biconnected case and it is improved by 1 in
the connected case. Finally, Algorithm PT draws a graph with at most
n
2 + 3 bends.

• CP constructs a 1-bend drawing PT constructs a 2-bend drawing except


for one edge with two bends, and BK constructs a 2-bend drawing.

• All three algorithms run in linear time.


Notice that for BK we have indicated better bounds than those reported in
[2] since we consider only almost cubic graphs.

4 Analysis of the Experimental Results


4.1 Performance Indicators
The experiments provide a detailed quantitative evaluation of the performance
of the three algorithms, both from an “aesthetic” point of view (area, number
of crossings, number of bends, edge length) and from a computational one.
Namely, the considered performance indicators for each algorithm are:

• 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.

Observe that we do not consider MaxEdgeBends (maximum number of


bends on any edge) because of the discussed theoretical results of the algorithms.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 10

4.2 Experimental Setting


In order to compare the performance of the three algorithms outlined in Sec-
tion 3, we have tested them on 18,000 randomly generated graphs with with
number of vertices in the range 10 . . . 300. The results of the experimentation
are presented in graphical form and reported in Figs. 10–21. We produced
the statistics by grouping the graphs by number of vertices. We decided not
to group the graphs by the number of edges since all at most cubic graphs are
sparse and all our sample graphs have more or less the same number of edges
for the same number of vertices. Therefore, data points in the diagrams are
averages over 300 graphs with the same number of vertices. Moreover, we give
two separate series of diagrams, one for biconnected graphs and one for simply
connected graphs.
Biconnected graphs were generated by adding, one at a time, an edge be-
tween two randomly chosen vertices with degree less than three. The generation
procedure ends when the graph becomes connected and the number m of in-
serted edges is such that 2.75n/2 ≤ m ≤ 3n/2. At the end of the procedure,
if the graph is biconnected it is added to the experimental suite, otherwise it
is discarded. Observe that this naive method to impose biconnectivity is not
computationally expensive because almost all at most cubic graphs with more
than 2.75n/2 edges are biconnected.
Simply connected graphs were generated by merging biconnected compo-
nents: the number of biconnected components is randomly chosen in the range
2 . . . n/20 and, accordingly, their size is randomly decided. The biconnected
components are generated using the previous procedure and then they are
merged together avoiding the creation of cycles.

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).

Figure 9: Example of ignored configuration in Algorithm PT.

4.4 Analysis
In this section, we discuss the results of the experiments and analyze in detail
the various performance indicators.

• The observed practical behavior of the algorithms is consistent with their


theoretical properties. Actually, the experimental results for some perfor-
mance indicators, such as the number of bends for connected graphs, are
slightly better than the theoretical worst-case bounds.
T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 12

• There is no significant difference between the results for biconnected and


simply connected graphs on the area, maximum edge length and running
time. On the contrary, there is a wide gap between the results for con-
nected and biconnected graphs on the number of bends, the number of
crossings and the total edge length. Justifications of this behavior are
given in the following.
• From a computational point of view, drawing cubic graphs is a well solved
problem: even the slowest algorithm takes only 6.8 ms to draw the largest
graphs (300 vertices).

We now discuss in detail each performance indicator.

• 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

Figure 11: Area versus number of vertices for biconnected graphs.


T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 14

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

Figure 15: Crossings versus number of vertices for biconnected graphs.


T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 16

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.

• MaxEdgeLen: (Figs. 16 and 17) and TotEdgeLen: (Figs. 18 and 19)


The experimental values of the maximum edge length are 1.4n, 0.5n and
0.6n in the connected case and 1.36n, 0.77n and 0.88n in the biconnected
case for Algorithms BK, CP and PT, respectively. The values of the
total edge length are 1/4n2 , 1/13n2 and 1/12n2 in the connected case and
2/7n2, 1/6n2 and 1/5n2 in the biconnected case for Algorithms BK, CP
and PT, respectively.
We have no theoretical bounds to compare these results to, but we ob-
serve that all the algorithms have considerably worse performance in the
biconnected case. This is because when two biconnected components are
merged, some edges are lengthened and influence these performance indi-
cators.

• 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

Figure 22: A graph with 30 vertices.

Figure 23: Graph of Fig. 22 drawn by Algorithm BK.


T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 21

Figure 24: Graph of Fig 22 drawn by Algorithm CP.

Figure 25: Graph of Fig 22 drawn by Algorithm PT.


T. Calamoneri et al., Experimental Comparison..., JGAA, 3(2) 1–23 (1999) 22

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

[13] S. Even, and R. E. Tarjan. Computing an st-numbering. Theoret. Comp.


Sci., 365–372, 1987.
[14] R. Greenlaw, and R. Petreschi. Cubic graphs. ACM Computing Surveys, 27
(4):471–495, 1995.
[15] M. Himsolt. Comparing and evaluating layout algorithms within GraphEd.
J. Visual Lang. Comput. (special issue on Graph Visualization), 6(3):255-
273, 1995.
[16] S. Jones, P. Eades, A. Moran, N. Ward, G. Delott, and R. Tamassia. A note
on planar graph drawing algorithms. Tech. Rep. 216, Department of Com-
puter Science, University of Queensland, 1991.
[17] G. Kant. Drawing Planar Graphs Using the canonical ordering. In Proc.
33th Ann. IEEE Symp. on Found. of Comp. Science (FOCS ’92), pages
101–110, 1992. Also in Algorithmica - Special Issue on Graph Drawing, 16:
4–32, 1996.
[18] Y. Liu, P. Marchioro, and R. Petreschi. At most single bend embedding of
cubic graphs. Tech. Rep. SI 92/01 Dept. of Comp. Science University of
Rome “La Sapienza”, 1992. Also in Applied Mathematics (Chin. Journ.),
9/B/2,127–142, 1994.
[19] A. Papakostas, and I.G. Tollis. Improved Algorithms and Bounds for Or-
thogonal Drawings. In Proc.Graph Drawing (GD’94), Lectures Notes in
Computer Science 894, Springer-Verlag, pages 40–51, 1994.
[20] A. Papakostas, and I.G. Tollis. Algorithms for Area-Efficient Orthogonal
Drawings. Comput. Geom. Theory Appl., 9:83–110, 1998.
[21] R.E. Prather. Design and Analysis of Hierarchical Software Metrics. ACM
Computing Surveys, 27 (4):497–518, 1995.
[22] M. S. Rahman, S. Nakano, and T. Nishizeki. A Linear-Time Algorithm for
Orthogonal Drawings of Triconnected Cubic Plane Graphs with the Mini-
mum Number of Bends. In Proc. Graph Drawing (GD’97), Lectures Notes
in Computer Science 1353, Springer-Verlag , pages 99–110, 1997.
Journal of Graph Algorithms and Applications
http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 3, pp. 1–27 (1999)

Subgraph Isomorphism in Planar Graphs and


Related Problems
David Eppstein
Department of Information and Computer Science
University of California, Irvine
http://www.ics.uci.edu/∼eppstein/
eppstein@ics.uci.edu

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.

Communicated by Roberto Tamassia: submitted December 1995, revised


November 1999.

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

• If connected pattern H has k occurrences as a subgraph of a planar graph


G, we can list all occurrences in time O(n + k). If H is 3-connected, then
k = O(n) [16], and we can list all occurrences in time O(n).
• We can count the number of induced subgraphs of a planar graph G iso-
morphic to any fixed connected pattern H in time O(n), and if there are
k occurrences we can list them in time O(n + k).
• For any planar graph G for which we know a constant bound on the
diameter, we can compute the exact diameter in time O(n).
• For any constant h we can solve the h-clustering and connected h-cluster-
ing problems [30] in planar graphs in time O(n).
• For any planar graph G for which we know a constant bound on the girth,
we can compute the exact girth in time O(n). The same bound holds if
instead of girth we ask for the shortest separating cycle or for the shortest
nonfacial cycle in a given plane embedding of the graph.
• For any planar graph G, we can compute the vertex connectivity and
edge connectivity of G in time O(n). (For planar multigraphs, we can test
k-edge-connectivity for any fixed k in time O(n).)
• For any planar graph G and any constant `, we construct in time O(n) a
linear-space routing data structure which can test for any pair of vertices
whether their distance is at most `, and if so find a shortest path between
them, in time O(log n).

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

Figure 1: Tree decomposition of a planar graph.

4 Bounded Tree-Width Subgraph Isomorphism


As a subroutine, we need to perform subgraph isomorphism testing in graphs
of bounded tree-width. This can be done by a standard dynamic programming
technique [9, 46]. The exact statement of the problem we solve is complicated by
the requirement that we count or list each subgraph isomorph exactly once. For
simplicity, we state the bounds for this problem with one parameter measuring
both the tree-width of the text and the size of the pattern.

Definition 1 A tree decomposition of a graph G consists of a tree T , in which


each node N ∈ T has a label L(N ) ⊂ V (G), such that the set of tree nodes
whose labels contain any particular vertex of G forms a contiguous subtree of T ,
and such that any edge of G connects two vertices belonging to the same label
L(N ) for at least one node N of T . The width of the tree decomposition is
one less than the size of the largest label set in T . The tree-width of G is the
minimum width of any tree decomposition of G.

We can assume without loss of generality (by splitting high-degree nodes


into multiple nodes with the same label) that each node in T has at most
three neighbors and that there are O(n) nodes in the tree. We will assign
our tree decomposition an arbitrary orientation, by rooting it at one of its
leaves, so that T becomes a binary tree. Figure 1 shows a planar graph, with
a tree decomposition of width three. In fact, the graph shown has no tree
decomposition of width two, so its tree-width is three.
Define the subtree rooted at a node N to consist of N and all its descendants.
Each such subtree is associated with an induced subgraph of G, having vertices
contained in labels of nodes in the subtree.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 6

A G
F H
F H

x
K
E K
L

D M
M

Figure 2: Partial isomorph of a pentagon in the induced subgraph associated


with node {F, H, K, M }, and corresponding partial isomorph boundary mapping
the pentagon to G0N .

Lemma 1 The subtree rooted at N provides a tree decomposition of the asso-


ciated induced subgraph of G.

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.

Proof: We perform dynamic programming in tree T . Let a partial isomorph


at a node N of the tree be an isomorphism between an induced subgraph H 0
of the pattern H and the induced subgraph of G associated with the subtree
rooted at N .
We let G0N be formed by adding two additional vertices x, y to the subgraph
of G induced by vertex set L(N ). We connect each of the two additional vertices
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 7

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).

• For each vertex v ∈ H, if B(v) 6= x then B1 (v) ∈ L(N ) ∪ {y}.


• At least one vertex v ∈ H has B1 (v) 6∈ L(N ) ∪ {y}.
We say that two partial isomorph boundaries B1 : H 7→ G0N1 and B2 : H 7→ G0N2
form a compatible triple with B if the following conditions both hold:
• B1 and B2 are both consistent with B.
• For each v with B(v) = x, exactly one of B1 (v) and B2 (v) is equal to y.
For each partial isomorph boundary B : H 7→ G0N , let X1 (B) be the number
of partial isomorphs which give rise to that boundary, and include a vertex of S.
Let X2 (B) be the number of partial isomorphs which give rise to that boundary,
and do not include a vertex of S. These values can be computed in a bottom-up
fashion as follows:

• If there is no v for which B(v) = x, then all partial isomorphs having


boundary B involve only vertices in L(N ), and can be enumerated by
brute force in time 2O(w log w) .
• Otherwise, we initialize X1 (B) and X2 (B) to zero. Then, for each partial
boundary B1 that is consistent with B, and such that there is no v with
B(v) = x and B1 (v) = y, we increment X1 (B) by X1 (B1 ) and increment
X2 (B) by X2 (B1 ). Finally, for each compatible triple B, B1 , B2 we incre-
ment X1 (B) by X1 (B1 ) · X1 (B2 ) + X1 (B1 ) · X2 (B2 ) + X2 (B1 ) · X1 (B2 )
and increment X2 (B) by X2 (B1 ) · X2 (B2 ).

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.

Proof: We first follow the above dynamic programming procedure, to compute


the values X1 and X2 for each partial isomorph boundary. We then compute
top-down in the tree the set of pairs (B, X) where B is a partial isomorph
boundary and X is either X1 or X2 , such that the value X(B) contributes to
the final count of subgraph isomorphs. These pairs can be identified as the ones
such that X(B) was included in the computation of some pair higher in the tree
that has been previously identified as contributing to the total, and that caused
a nonzero increment in this computation. Finally, we compute bottom-up again,
listing for each contributing pair (B, X) the partial subgraph isomorphs counted
in the value X(B). This step can be performed by mimicking the initial com-
putation of X(B) described in the previous lemma, restricted to the boundaries
known to contribute to the overall total, replacing each increment by a concate-
nation of lists, and replacing each multiplication with the construction of partial
isomorphs from a Cartesian product of two previously-computed lists.
The number of steps for this computation is proportional to the number of
steps in the previous algorithm, together with the added time for each combi-
nation of a pair of partial isomorphs. Each such combination can be charged
to a subgraph isomorph included in the output, and each output isomorph is
formed by a binary tree of combinations that takes O(w) time to perform, so
the total added time is O(kw). 2
The same dynamic programming techniques also lead to similar results for
counting or listing induced subgraphs isomorphic to H. To do this, we need only
modify the algorithms above to restrict attention to partial isomorph boundaries
B : H 7→ G0N in which all edges between vertices of L(N ) are covered by the
image of some edge in H.

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.

Lemma 5 Let G be a planar graph, and w be a given integer parameter. Then


we can find a collection of subgraphs Gi and a partition of the vertices of G into
subsets Si with the following properties:
• Every vertex of G is included in at most w subgraphs Gi .
• We can find a tree decomposition of each subgraph Gi with tree-width at
most 3w − 1.
• If H is a connected w-vertex subgraph of G, and i is the smallest value
for which H ∩ Si is nonempty, then H is a subgraph of Gi but is not a
subgraph of any Gj with j > i.
• The total time for performing the partition and computing the tree decom-
positions is O(w 2 n).

Proof: We choose an arbitrary starting vertex v0 , and let Si consist of the


vertices atSdistance i from v0 . We then let Gi be the graph induced by the
i+w−1
vertex set j=i Sj , as shown in Figure 4. Clearly, the sets Si form a partition
of the vertices of G, and each vertex is in at most w subgraphs Gi .
Then for i = 0, Gi consists of the vertices at distance at most w − 1 from
v0 , so by applying Lemma 4 to its breadth first spanning tree we can find a
tree decomposition with width at most 3(w − 1). To show that each Gi with
i > 0 has low tree-width, form an auxiliary graph G0i from G by collapsing into
a single supervertex all the vertices at distance less than i from v0 , and deleting
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 11

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

6 The Subgraph Isomorphism Algorithm


We first describe the result for the special case of connected patterns.

Theorem 1 We can count the isomorphs or induced isomorphs of a given con-


nected pattern H, having w vertices, in a planar text graph G with n vertices,
in time 2O(w log w) n. If there are k such isomorphs we can list them all in time
2O(w log w) n + O(wk).

Proof: The algorithm consists of the following steps:


1. Apply the method of Lemma 5 to find a partition of the vertices into sets
Si associated with graphs Gi having low width tree decompositions.
2. For each i ≥ 0, count or list the subgraph isomorphs of H in Gi that involve
at least one vertex of Si , using the algorithm of Lemma 2 or Lemma 3
respectively.
3. Sum all the counts or concatenate the lists, to get a count or list of the
isomorphs in G.
By Lemma 5, each isomorph of H in G occurs in exactly one way as an isomorph
in Hi that involves at least one vertex of Si , so the algorithm produces the
correct total count or list. The time for the first step is O(w 2 n), and the time
forPthe last step is O(n), both dominated by the time for the second step which
is 2O(w log w)|Gi | + O(ki w), where the 2O(w log w) factor arises by plugging the
3w − 1 treewidth bound of LemmaP5 into the P analysis in Lemmas 2 and 3.
This can be simplified to 2O(w log w)( |Gi |) + O( ki w) = 2O(w log w) · O(wn) +
O(kw) = 2O(w log w)n + O(kw). 2
The method so far requires that the pattern be connected. We now describe
a general method for handling disconnected patterns. The technique will let
us count the number of matching patterns, after which some sort of separator-
based divide and conquer can likely be used to find an instance of a matching
pattern, but we have been unable to extend this technique to the problem of
listing all subgraph isomorphs of a disconnected pattern.

Theorem 2 We can count the isomorphs of any (possibly disconnected) pattern


H having at most w of vertices, in a planar text graph G with n vertices, in time
2O(w log w) n.

Proof: Let #G (H) denote the number of isomorphs of H in G. Rather than


counting the isomorphs of a single pattern, we count the isomorphs of all planar
graphs having at most w vertices. There are only 2O(w) such graphs [47], so
this factor does not change the overall form of our time bound. We order these
graphs by the number of connected components, so that when we are processing
a particular graph H we can assume we already know the values of #G (H 0 ) for
every H 0 with fewer components.
Our algorithm them performs the following steps on each graph H:
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 13

1. If H is connected, compute #G(H) using the algorithm of Theorem 1.


0 00
P of two subgraphs H and H , and
2. Otherwise, let H be the disjoint union
0 00
let #G(H) = #G(H ) · #G (H ) − ki #G(Hi ), where the sum is over all
graphs Hi with fewer components than H, and ki denotes the number of
different ways Hi can be formed as the union of H1 and H2 .
The product #G (H 0 ) · #G(H 00 ) counts the number of ways of mapping H
into G such that both H 0Pand H 00 are isomorphically mapped but their instances
may overlap. The term ki #G (Hi ) corrects for these overlaps by subtracting
the number of overlapped occurrences of each possible type.
The coefficients ki may be computed by brute force enumeration of all pos-
sible ways of marking a vertex of Hi as coming from H 0 , H 00 , or both, combined
with a planar graph isomorphism algorithm, in time 2O(w) . Therefore, the over-
all time taken in the second step of the algorithm is 2O(w) , independent of n,
and the total time is dominated by the first step, in which we apply Theorem 1
to 2O(w) connected graphs, taking time 2O(w log w) n. 2

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)).

Lemma 6 Let H be a given pattern graph, and N be a node of a tree decompo-


sition of graph G. Then there are at most 2K|L(N)| (H)+|L(N)| log(|H|+1) different
possible partial isomorph boundaries B : H 7→ G0N (as defined in the proof of
Lemma 2).

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

Lemma 7 Suppose that planar graph H is Hamiltonian, or is 3-connected, or


is connected and has bounded degree. Then for any set S of vertices of H, H −S
has O(|S|) connected components.

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

Theorem 3 If a given pattern H is Hamiltonian, 3-connected, or connected of


bounded degree, we can count the isomorphs of H in a planar text graph G with
n vertices in time 2O(diam(H) log |H|) n.

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:

Theorem 4 We can count the isomorphs of any wheel Wk in a planar text


graph G with n vertices in time O(nk 2 ).

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

8 Variations and Applications


We now describe briefly how to use our subgraph isomorphism algorithm to
solve certain other related graph problems. For instance, we can find the girth
(shortest cycle), or smallest nonfacial cycle (for some particular embedding)
simply by searching for isomorphs of small cycles:

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 test for each integer i = 3, 4, 5 . . . whether there is a cycle (or


nonfacial cycle) of length i. To test if there is a nonfacial cycle, we count the
total number of cycles of length i in the graph andPsubtract the number of faces
of length i. The total time for this procedure is i≤g 2O(i log i) n = 2O(g log g) n.
For the nonfacial cycle problem, once the length of the cycle is known, we can
find a single such cycle by performing our subgraph isomorph listing algorithm,
stopping once k + 1 cycles are generated, where k = O(n) is the number of faces
of the given length. By radix sorting the list of cycles (in lexicographic order by
their sequences of vertex indices) we can then test in linear time which of the
generated cycles are nonfacial. 2

Theorem 6 We can find a shortest separating cycle C in a planar graph, in


time 2O(|C| log |C|) n.

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

Figure 5: An embedded planar graph G, the vertex connectivity substitute


graph G0 (with edges drawn as heavy curves), and the edge connectivity substi-
tute graph G00 .

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

Proof: Let A be a connected component of G \ S, let GA be formed from G


by contracting A into a supervertex, and let S 0 be the set of faces and vertices
adjacent to the contracted supervertex. Then (since it is just the neighborhood
of a vertex) S 0 has the structure of a cycle in G0 , and separates A from G\{A∪S}.
If S is minimal, then it must consist of exactly the original vertices in S 0 . The
converse is immediate, since no edge in the embedding of G can cross a face or
vertex in C. 2
Theorem 8 We can compute the vertex connectivity of a planar graph in O(n)
time.
Proof: We can assume without loss of generality that G is two-connected, so
the graph G0 described in Lemma 8 has no multiple adjacencies. We form G0
as above and find the shortest cycle in G0 that separates two original vertices.
As with the shortest separating cycle problem (Theorem 6) this can be done by
a slight modification to our dynamic programming method that decorates the
dynamic programming states with O(1) bits of additional information regarding
the separated vertices. Since any planar graph has a vertex of degree at most
five by Euler’s formula, the shortest cycle in G0 must have length at most ten,
so the algorithm takes time O(n). 2
The edge connectivity of a graph is similarly defined as the minimum number
of edges the removal of which disconnects the graph. For simple graphs, this
can again be at most five but for multigraphs it can be higher.
Theorem 9 We can compute the edge connectivity of a simple planar graph in
O(n) time.
Proof: Assume without loss of generality that G is two-edge-connected. Em-
bed G, and form a graph G00 by subdividing each edge of G and connecting
the resulting subdivision points to new vertices in each adjacent face; this con-
struction is illustrated in the right of Figure 5. Then G00 is a planar graph
with n original vertices, e edge-vertices on each edge of G, and f face-vertices
in each face of G, so its total complexity is O(n). By the assumption of two-
edge-connectivity, G00 is simple. One can use an argument similar to the one
in Lemma 8, in which we delete a cutset from G, contract a connected com-
ponent, and examine the neighborhood in G of the contracted supervertex, to
show that G is k-edge-connected iff there is no cycle of fewer than 2k edge- and
face-vertices in G00, which separates two original vertices. As before, the degree
bound on a planar graph imposes a limit of ten on the length of the shortest
such cycle, and as before this cycle can be found by a minor modification to our
dynamic programming algorithm. 2
The same methods extend easily enough to multigraphs, but now the edge
connectivity can not be bounded a priori, so we need to include the connectivity
in our time bound.
Theorem 10 For any fixed k, we can test k-edge-connectivity of a planar multi-
graph in time 2O(k log k) n.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 18

Proof: Without loss of generality, the multiplicity of any edge is at most k, as


higher multiplicities can not improve the overall connectivity. After the edge
subdivision step in the construction of G00 , the resulting graph is a simple planar
graph with O(kn) vertices, after which we can proceed as in the remainder of
Theorem 9. 2

9 Shortest Path Data Structure


We next describe a technique for finding shortest paths in planar graphs. Let a
parameter ` be given (typically, a fixed constant). We wish to test, for any two
vertices u and v, whether there is a path from u to v of distance at most `, and
if so return the shortest such path.
Since we wish to use an amount of space independent of `, we need a variant
of Lemma 5 in which the total size of the subgraphs is not so large.

Lemma 9 Let G be a planar graph, and w be a given integer parameter. Then


we can find a collection of subgraphs Gi and a partition of the vertices of G into
subsets Si with the following properties:
• Every vertex of G is included in at most two subgraphs Gi .
• We can find a tree decomposition of each subgraph Gi with tree-width
O(w).
• Gi contains the `-neighborhood of every vertex in Si .
• The total time for performing the partition and computing the tree decom-
positions is O(wn).

Proof: As in Lemma 5, we compute the distances of each vertex from some


arbitrary starting vertex v0 . We then let Si consist of those vertices with dis-
tance at least 2iw and at most (2i + 2)w − 1 from v0 , and we let Gi be the
graph induced by the set of vertices with distances at least (2i − 1)w and at
most (2i + 3)w − 1 from v0 . The proof that these graphs have treewidth O(w)
and that each Gi contains the `-neighborhood of Si is essentially the same as
that of Lemma 5. 2
As before, by introducing dummy nodes, we can assume without loss of
generality that each node in the tree decomposition of Gi has at most three
neighbors. We warm up with a data structure for our shortest path queries that
uses more space than necessary, but for which queries are very fast.

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

Proof: By performing the decomposition of Lemma 9 we can assume without


loss of generality that we have a tree decomposition T for G of width O(`).
As with any tree, we can find a node N the removal of which disconnects T
into subtrees of size at most |T |/2. Our primary data structure consists of the
distances d(x, z) from each vertex x ∈ G to each vertex z ∈ L(N ), together with
a recursively constructed data structure in each subtree.
To answer a query pair x, y where the two vertices belong to different subtrees
of T , we can simply try each of the O(D) values d(x, z) + d(z, y) where z ranges
over all the members of L(N ). To answer a query where the two vertices belong
to the same subtree, we can use the recursively defined structure in that subtree.
It remains to show how we quickly determine which node N is eventually
used to answer each query. To do this, define the level of a node to be the
stage in the recursive subdivision process at which the node was chosen, and
define the superior of a node N to be the node chosen at the next earlier level
in the subtree containing N . The links from a node to its superior define a
tree structure T 0 different from the original decomposition tree T . Further,
define the home node of a vertex v to be the node with the earliest level with
v ∈ L(N ). Note that, because of the requirements that the labels containing v
are contiguous, the home node is uniquely defined. Then, the node to be used
in answering a query pair x, y is simply the least common ancestor in T 0 of the
home nodes of x and y. 2
To return the actual shortest path, rather than simply the distance between
a pair of nodes, we can store a single-source shortest path tree for each member
of L(N ), and return the path in the tree for the member of L(N ) giving the
smallest distance.
We next show how to reduce the space to linear, at the expense of increasing
the query time.

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.

Proof: As above, we can assume G has a tree decomposition of width O(`),


which we assume has the form of a rooted binary tree. Define levels in this tree
and home nodes of vertices as above, except that we terminate the recursive
subdivision process when we reach subtrees with fewer than ` nodes (which we
call small subtrees). If the node labels containing a vertex v belong only to
nodes in a small subtree S, then v does not have a home node, instead we say
that S is v’s home subtree.
Define a pair of nodes in T to be related if there is no node between them
with an earlier level than both. Then, each node N is related to O(1) nodes at
each level: one node at an earlier level than N , and at most one node in each
later level in each of the at most three subtrees formed by removing N from T .
Therefore, there are O(n/`) pairs of related nodes.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 20

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.

Theorem 13 We can compute the diameter D of a planar graph G, in time


O(2O(D log D) n).

Proof: We begin by performing a breadth first search from an arbitrary vertex.


This will produce a tree of height at most D, so by Lemma 4 we can find a tree
decomposition of width O(D), which as usual we can assume has the form of a
rooted binary tree. We first perform a bottom-up sweep of this tree to compute
for every node N the distances between every pair of vertices in L(N ), in the
graph associated with the subtree rooted at N . These O(D2 ) distances can
be found by combining the distance matrices of the two children of N , in time
O(D3 ), so this phase takes time O(D3 n). We then sweep the decomposition top
down, computing for every node N the distances between every pair of vertices
in L(N ), in the whole graph G. The first pass correctly computed these distances
at the root of the tree, and at any other node N the distances can be computed
by combining the distance matrices of the parent of N (previously computed in
the top-down sweep) and its two children (computed in the bottom-up sweep),
again in time O(D3 ) per node.
We finally sweep through the tree decomposition bottom up, keeping at each
node N a subset S of the vertices seen so far in the subtree rooted at N , together
with the distances from each member of S to each member of L(N ). When we
process a node N , we perform the following steps:
1. Let the set S for node N consist of the union of the corresponding sets S1
and S2 for its children N1 and N2 , together with L(N ).
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 21

2. Compute the distances from each member of S to each member of L(N ),


by combining the previously computed distances to L(N1 ) or L(N2 ) with
the distances within L(N1 ) ∪ L(N2 ).
3. Compute the distance between each pair of nodes x, y where x ∈ S1 \L(N )
and y ∈ S2 \ L(N ), by testing the distances through all O(D) possible
intermediate nodes in L(N ).
4. Radix sort the members of S according to the lexicographic ordering of
their O(D)-tuples of distances to L(N ), and eliminate all but one member
for each distinct tuple.
The value returned as the diameter is then the maximum of the distances from
S to L(N ) computed in the second step, and the distances of pairs x, y comuted
in the third step
If any eliminated member x of a tuple belongs to a diametral pair x, y, where
y is not in the subgraph associated with N , then the uneliminated member x0
with the same tuple would have the same distance to y, and would form another
diametral pair. Therefore, the algorithm above will correctly find and report a
diametral pair.
The number of distinct O(D)-tuples of integers in the range from 0 to D
is 2O(D log D) , hence this gives a bound on the size of each set S. The time to
compute distances between pairs x, y is O(D) times the square of this quantity,
which is still 2O(D log D) . 2

10 Other Graph Families


Our results for planar graphs use the assumption of planarity in two ways. First,
in the bound relating tree-width to diameter (Lemma 4), the proof is based on
the existence of a planar embedding of the graph, and in fact there is no similar
bound in general for nonplanar graphs; for instance the complete graph Kn has
diameter one but tree-width n − 1. Second, in the cover of G by low-treewidth
subgraphs described in Lemma 5, we needed the fact that planar graphs are
closed under minors to show that the graph G0i is planar, allowing us to apply
Lemma 4 to it.
This naturally raises the question, for which other minor-closed graph fami-
lies can we prove a bound relating diameter to tree-width, similar to Lemma 4?
Such a result would then let us apply our subgraph isomorphism techniques
unchanged to any such families. In the conference version of this paper [18], we
announced an exact characterization of these families, which are detailed in a
separate journal paper [15] and which we now summarize:

Definition 3 Define a family F of graphs to have the diameter-treewidth prop-


erty if there is some function f(D) such that every graph in F with diameter at
most D has treewidth at most f(D).
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 22

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).

Theorem 14 ([15]) Let F be a minor-closed family of graphs. Then F has


the diameter-treewidth property iff F does not contain all apex graphs.

Corollary 1 Let F be a minor-closed family of graphs, such that some apex


graph is not in F . Let H be a fixed graph in F . Then there is a linear time
algorithm for testing whether H is a subgraph of a given graph G ∈ F.

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.

11 Conclusions and Open Problems


We have shown how to solve planar subgraph isomorphism for any pattern in
time O(n). We have also solved certain related problems in similar time bounds.
A number of generalizations of the problem remain open:

• 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

[14] M. B. Dillencourt and W. D. Smith. A linear-time algorithm for testing


the inscribability of trivalent polyhedra. Proc. 8th Symp. Computational
Geometry, pp. 177–185. Assoc. Comput. Mach., 1992.
[15] D. Eppstein. Diameter and treewidth in minor-closed graph families. To
appear in Algorithmica, math.CO/9907126.
[16] D. Eppstein. Connectivity, graph minors, and subgraph multiplicity. J.
Graph Theory 17:409–416, 1993.
[17] D. Eppstein. Arboricity and bipartite subgraph listing algorithms. Infor-
mation Processing Letters 51:207–211, 1994.
[18] D. Eppstein. Subgraph isomorphism in planar graphs and related problems.
Proc. 6th Symp. Discrete Algorithms, pp. 632–640. Assoc. Comput. Mach.
and Soc. Industrial & Applied Math., 1995.
[19] D. Eppstein, Z. Galil, G. F. Italiano, and T. H. Spencer. Separator
based sparsification II: edge and vertex connectivity. SIAM J. Comput-
ing 28(1):341–381, 1999.
[20] M. R. Fellows and M. A. Langston. On search, decision and the efficiency
of polynomial-time algorithms. Proc. 21st Symp. Theory of Computing, pp.
501–512. Assoc. Comput. Mach., 1989.
[21] G. N. Frederickson. Fast algorithms for shortest paths in planar graphs,
with applications. SIAM J. Computing 16:1004–1022, 1987.
[22] G. N. Frederickson. Ambivalent data structures for dynamic 2-edge-
connectivity and k smallest spanning trees. SIAM J. Comput. 26(2):484–
538, April 1997.
[23] G. N. Frederickson and R. Janardan. Efficient message routing in planar
networks. SIAM J. Computing 18:843–857, 1989.
[24] G. N. Frederickson and R. Janardan. Space-efficient message routing in
c-decomposable networks. SIAM J. Computing 19:14–30, 1990.
[25] H. N. Gabow. A matroid approach to finding edge connectivity and packing
arborescences. J. Computer & System Sciences 50:259–273, 1995.
[26] A. Guha. Optimizing codes for concurrent fault detection in micropro-
grammed controllers. Proc. Int. Conf. Computer Design: VLSI in Comput-
ers and Processors (ICCD ’87), pp. 486–489. Inst. Electrical & Electronics
Engineers, 1987.
[27] D. Hong, Y. Wu, and X. Ding. An ARG representation for Chinese char-
acters and a radical extraction based on the representation. Proc. 9th Int.
Conf. Pattern Recognition, vol. 2, pp. 920–922. Inst. Electrical & Electron-
ics Engineers, 1988.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 26

[28] A. Itai and M. Rodeh. Finding a minimum circuit in a graph. SIAM J.


Computing 7:413–423, 1978.
[29] A. Kanevsky, R. Tamassia, G. Di Battista, and J. Chen. On-line main-
tenance of the four-connected components of a graph. Proc. 32nd IEEE
Symp. Foundations of Computer Science, pp. 793–801, 1991.
[30] J. M. Keil and T. B. Brecht. The complexity of clustering in planar graphs.
J. Combinatorial Mathematics and Combinatorial Computing 9:155–159,
1991.
[31] P. N. Klein and S. Sairam. Fully dynamic approximation schemes for short-
est path problems in planar graphs. Algorithmica 22(3):235–249, November
1998.
[32] G. Kortsarz and D. Peleg. On choosing a dense subgraph. Proc. 34th
Symp. Foundations of Computer Science, pp. 692–703. Inst. Electrical &
Electronics Engineers, 1993.
[33] J. R. Koza, F. H. Bennett, III, and O. Stiffelman. Genetic programming as
a Darwinian invention machine. Proc. 2nd Worksh. Genetic Programming
(EuroGP ’99). Springer-Verlag, Lecture Notes in Computer Science 1598,
1999, http://www.genetic-programming.com/EUROGP99.ps.
[34] S. Y. T. Lang and A. K. C. Wong. A sensor model registration technique
for mobile robot localization. Proc. Int. Symp. Intelligent Control, pp.
298–305. Inst. Electrical & Electronics Engineers, 1991.
[35] J.-P. Laumond. Connectivity of plane triangulations. Information Process-
ing Letters 34:87–96, 1990.
[36] R. Levinson. Pattern associativity and the retrieval of semantic networks.
Computers and Mathematics with Applications 23:573–600, 1992.
[37] A. Lingas. Subgraph isomorphism for biconnected outerplanar graphs in
cubic time. Theoretical Computer Science 63:295–302, 1989.
[38] A. Lingas and A. Proskurowski. On parallel complexity of the subgraph
homeomorphism and the subgraph isomorphism problem for classes of pla-
nar graphs. Theoretical Computer Science 68:155–173, 1989.
[39] A. Lingas and M. M. Syslo. A polynomial-time algorithm for subgraph
isomorphism of two-connected series-parallel graphs. Proc. 15th Int. Col-
loq. Automata, Languages and Programming, pp. 394–409. Springer-Verlag,
Lecture Notes in Computer Science 317, 1988.
[40] C. H. Papadimitriou and M. Yannakakis. The clique problem for planar
graphs. Information Processing Letters 13:131–133, 1981.
D. Eppstein, Planar Subgraph Isomorphism, JGAA, 3(3) 1–27 (1999) 27

[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)

New Trends in Graph Drawing

Special Issue on Selected Papers from the


1997 Symposium on Graph Drawing

Guest Editors’ Introduction


Giuseppe Di Battista
Dipartimento di Informatica e Automazione
Università degli Studi di Roma Tre
via della Vasca Navale 79, 00146 Roma, Italy
gdb@dia.uniroma3.it

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)

Drawing Clustered Graphs on an Orthogonal


Grid
Peter Eades
Department of Computer Science and Software Engineering
University of Newcastle
http://www.cs.newcastle.edu.au/

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

Deakin JCU UQ Griffith

Melbourne

LaTrobe
NSW UNE

MU Ncle Sydney UTS

Monash SU UNSW

Figure 1: An example of a clustered graph.


P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 5

8 7
6
7 6 5

5 4
3 4 3
2
2
1
1
(a) (b)

Figure 2: (a) A planar graph. (b) A visibility representation of the graph.

The orthogonal grid drawing convention appears in a number of applica-


tions, such as VLSI circuit design [27, 29, 47, 48] and diagrammatic interfaces
for relational information systems [1, 42, 32, 35, 40]. Under the orthogonal
grid drawing convention, minimizing the number of bends and minimizing the
area are the main criteria both for diagram readability and for VLSI design
applications.
For classical graphs, several basic results regarding planar orthogonal grid
drawings have appeared in the literature. It has been shown by Valiant [48]
that any planar graph of degree at most 4 admits a planar orthogonal grid
drawing with area O(n2 ); further, there are graphs which need quadratic area.
Tamassia [41] presented an O(n2 log n) time algorithm that computes a planar
orthogonal grid drawing with a given planar embedding so that the number
of bends is minimized. Garg and Tamassia [19] have shown that if the planar
embedding is not given, then the problem is NP-hard.
Several linear time algorithms for planar orthogonal grid drawings of classical
graphs have been developed. Tamassia and Tollis [44, 45] have presented an
algorithm that outputs drawings with O(n2 ) area, where n is the number of the
vertices of the graph. If the graph is biconnected, then there are at most 2n + 4
bends in the drawing; otherwise, there are at most 2.4n + 2 bends. Further,
there are at most 4 bends in each edge. If the graph is biconnected, then all but
2 edges have at most 2 bends. Kant [23, 24] has presented an algorithm which
improves the result of Tamassia and Tollis in some cases. For triconnected
graphs, Kant’s algorithm draws on an n × n grid with at most 2 bends per
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 6

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

if the drawing of e crosses the boundary of R more than once. A drawing of a


clustered graph is c-planar if there are no edge crossings or edge-region crossings.
If a clustered graph C has a c-planar drawing then we say that it is c-planar.
A clustered graph C = (G, T ) is a connected clustered graph if each cluster
induces a connected subgraph of G. The following results from [14, 16] charac-
terize c-planarity in a way which can be exploited by our drawing algorithms.

Theorem 1 A connected clustered graph C = (G, T ) is c-planar if and only if


the graph G is planar and there exists a planar drawing D of G, such that for
each node ν of T , all the vertices and edges of G − G(ν) are in the external face
of the drawing of G(ν).

Let C1 = (G1 , T1 ) and C2 = (G2 , T2 ) be two clustered graphs such that T1


is a subtree of T2 and for each node ν of T1 , G1 (ν) is a subgraph of G2 (ν). We
say that C1 is a sub-clustered-graph of C2 .

Theorem 2 A clustered graph C = (G, T ) is c-planar if and only if it is a


sub-clustered graph of a connected and c-planar clustered graph.

From Theorem 2, we can assume that we are given a connected clustered


graph when drawing a c-planar clustered graph. For each vertex u, a doubly-
linked list A(u) of edges around u is given; the edges in A(u) appear around u
in the order of the list in the embedding. In the rest of the paper, we further
assume that in a clustered graph C = (G, T ), every non-leaf node of tree T has
at least two children. Hence the size of T = (V, A) is O(|V| + |A|) = O(n).
Our techniques use the concept of planar st-graphs [2]. A planar st-graph
is a planar directed graph with one source s and one sink t, such that both the
source and the sink above can be embedded on the boundary of the same face,
say the external face.

3 Orthogonal Drawings for C-planar Clustered


Graphs
An orthogonal grid rectangular cluster drawing (OGRC drawing) of a clustered
graph maps the graph onto a grid, where edges are drawn as sequences of hor-
izontal and vertical segments, vertices are drawn on grid points, and region
boundaries for clusters are drawn as rectangles. Figure 1 is derived from an
OGRC drawing. In this section, we present an algorithm that produces a c-
planar OGRC drawing for a given c-planar clustered graph C = (G, T ) in which
each vertex of G has degree at most 4 in G. The drawing has O(n2 ) area, and
at most 3 bends in each edge. The algorithm works in linear time, and consists
of three phases:
(1) visibility representation;
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 9

(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.

3.1 Visibility Representation


A visibility representation Γ for a planar st-graph G maps each vertex v into a
horizontal segment Γ(v), and each edge e into a vertical segment Γ(e) such that:
(1) Segments Γ(u) and Γ(v) are disjoint for distinct vertices u and v.
(2) If e = (u, v), then the segment Γ(e) has its bottom endpoint on Γ(u), its
top endpoint on Γ(v) and does not intersect any other segment.
A visibility representation of a clustered graph C = (G, T ) consists of a
visibility representation of G as well as an isothetic rectangle for each node ν
of T , such that the rectangles satisfy the same constraints as the regions for
clusters as given in Section 2. An example is in Figure 3(b).
The first phase of our algorithm produces a visibility representation of the
input clustered graph. The input clustered graph is enhanced by adding some
dummy vertices and edges; this makes a classical graph. A visibility drawing of
this classical graph is made; the horizontal lines connecting two horizontal bars
(where each horizontal bar represents a dummy vertex) become the horizontal
sides of the cluster rectangles, and the vertical lines representing the dummy
edges become the vertical sides of the rectangles.
The visibility phase has the following steps:
1. Triangulate an input clustered graph C = (G, T ), and compute a specific
kind of st-numbering, called a “c-st numbering”.
2. Find specific kinds of facial triangles, called “support triangles” for each
cluster in the triangulated graph; intuitively, these form the left and right
boundaries for each cluster.
3. Extend the original graph C = (G, T ) with dummy vertices and edges.
4. Extend the c-st numbering.
5. Find a constrained visibility drawing, and replace the dummy vertices and
edges with rectangles.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 10

Our method depends critically on the constrained visibility algorithm of


Di Battista, Tamassia and Tollis [3]; this is reviewed and extended slightly in
the following subsection. Then we describe each of the steps above in turn.
The algorithm described by the steps above produces a visibility represen-
tation of the input clustered graph, and does not require that the input graph
has maximum degree 4. However, for Section 3.2, the input must be restricted
to maximum degree four, and some alignment constraints must be used to limit
the number of edge bends in the final drawing. These alignment constraints are
described in subsection 3.1.7.
Some remarks on the construction of the visibility representation are in sub-
section 3.1.8.

3.1.1 Constrained visibility drawings


The Constrained Visibility algorithm described in [3] takes as inputs a planar
st-graph G and a set Π of paths in G, and it produces a visibility drawing of G
so that the x-coordinates of Γ(e) and Γ(e0 ) are the same whenever e and e0 are
the edges in the same path in Π. The set Π is restricted to “non-crossing paths”
in the following sense. Two paths π1 and π2 of G are said to be non-crossing
if they are edge disjoint and do not cross at common vertices, that is, there is
no vertex v of G with edges e1 , e2 , e3 and e4 incident in this clockwise order
around v, such that e1 and e3 are in π1 and e2 and e4 are in π2 .
For each vertex u in G, the original algorithm Constrained Visibility of [3]
chooses the y-coordinate of Γ(u) to be the length of the longest directed path
from s to u in G. In fact, we can vary the original algorithm to use a topological
order λ of an st-graph G as an additional input of Constrained Visibility: the
y-coordinate of Γ(u) is λ(u) for each u ∈ V . Looking at it in a different way, we
apply Constrained Visibility to the graph obtained by inserting λ(v) − λ(u) − 1
new vertices in each directed edge (u, v), regarding the resulting paths as part
of the set of non-crossing paths. This variation is important for some of the
details below.
In our algorithm, the y coordinates of the vertices are the “c-st numbers” of
the vertices, a specific kind of topological order, as defined in the next subsection.

3.1.2 Computing a c-st numbering


When transforming the clustered graph to a planar st-graph, we need to consider
the clustering structure so that the visibility representation that we produce re-
spects the clustering constraints. This is achieved by computing an st-numbering
of the vertices of G such that the vertices that belong to the same cluster are
numbered consecutively. We call this numbering c-st numbering. The c-st num-
bers are used for the y-coordinates of vertices; the consecutiveness ensures that
the vertices of each cluster occupy a vertical range. In this paper, a c-st num-
bering λ : V → {1, 2, . . . , n} of an n vertex clustered graph may have the same
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 11

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).

Lemma 1 [9, 10] Suppose that C = (G, T ) is a connected c-planar clustered


graph, and G is triangulated. Then a c-st numbering of C can be found in O(n)
time.

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.

3.1.3 Find support triangles for each cluster


Next we show how to obtain the 4 bounding sides of the rectangle for a cluster
ν. To do this, we need some further terminology. We say that an edge is an
outward edge (resp., inward edge) of a cluster ν if its tail (resp., head) is inside
the cluster and its head (resp., tail) is outside the cluster.
As preprocessing, we introduce two new edges (s∗ , s) and (t, t∗) with new
vertices s∗ and t∗ outside of G so that each cluster ν has an outward edge and an
inward edge. Then we triangulate the graph, as shown in Figure 4, introducing
two edges between s∗ and t∗ ; the use of these new edges is described later. The
resulting graph G∗ is clearly a planar st-graph with source s∗ and sink t∗ .
Note that an outward edge for a cluster ν may well be an outward edge for
several clusters, and in fact the sum of the number of outward edges for cluster ν
over all clusters ν may be quadratic. We are aiming for a linear time algorithm;
to this end we identify a linear number of outward edges with which we can
form a rectangle for each cluster. Let L+ (ν) and R+ (ν) denote the leftmost
outward edge and the rightmost outward edge of a cluster ν ∈ V respectively
in G∗ (it is possible that L+ (ν) = R+ (ν)). Similarly, L− (ν) and R− (ν) denote
the leftmost inward edge and the rightmost inward edge of ν respectively.
Identifying the edges L− (ν), L+ (ν), R− (ν) and R+ (ν) helps to define new
dummy edges that will form the four bounding sides of the rectangle for a
cluster ν. There are at most four of these edges for each cluster, so that the
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 12

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)

Figure 5: Computing support triangles.

1. Pre-process tree T to prepare for computing c(u, v) for any pair u, v of


vertices of G.
2. For each facial triangle τ = (u1 , u2 , u3 ) of G with directed edges e1 =
(u1 , u2 ), e2 = (u2 , u3 ) and e3 = (u1 , u3 ):
(a) compute µ = min{c(u1 , u2 ), c(u2 , u3 )}
(b) Traverse T from u2 toward the root. Stop the traversal if we reach
µ, or if we encounter a node for which a support triangle has been
assigned. At each node ν traversed (except for the final node), we
assign τ as a support triangle for ν.
From [21, 37], steps 1 and 2(a) take linear time. For step 2(b), note that
since each cluster has two support triangles, each node of T is visited at most
twice. Thus the total running time is O(|T |), that is, linear.
Given the support triangles, it is easy to compute the edges L− (ν), L+ (ν),
R (ν) and R+ (ν). For each cluster ν, L− (ν) = e1 and L+ (ν) = e2 if e2 =

(u2 , u3 ) is clockwise next to e1 = (u1 , u2 ) around u2 ; R− (ν) = e1 and R+ (ν) =


e2 otherwise. Clearly, the entire running time is O(|V|), that is, O(n).

3.1.4 Extending the graph with dummy vertices and edges


The next step in the algorithm is to modify G(ν) in G∗ recursively from top to
bottom of the tree T , using the edges L− (ν), L+ (ν), R−(ν) and R+ (ν). The
head and tail of a directed edge e are denoted by head(e) and tail(e) respectively.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 14

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- ( ν)

Figure 6: Modify G(ν), adding dummy vertices to represent the rectangle.

We modify every subgraph G(ν) recursively as above, obtaining an extended


graph F that includes the dummy vertices for the rectangles.
It can be easily verified that the leftmost outward edge of a cluster does not
change during the modification for the following reasons.
(i) The edge L+ (ν) cannot be R− (ν 0 ) for any other cluster ν 0 (since the graph
G∗ is triangulated).
(ii) Since we apply the transformation from top to bottom, adding new edge
(`u(ν), head(L+ (ν)) to G(ν) does not affect the definition of L+ (ν 0 ), L− (ν 0 )
or R− (ν 0 ) for any other cluster ν 0 which is not an ancestor of ν.
Similarly we do not have to recompute the rightmost outward, leftmost in-
ward and rightmost inward edges of a cluster during the modification. It follows
that the above modification can be completed in O(n) time.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 15

The resulting graph F is clearly a planar st-graph. It is trivial to add the


dummy vertices to T to make an extended cluster tree T ∗ ; this gives an extended
clustered graph C ∗ = (F, T ∗ ). Since we add 4 dummy vertices and 6 dummy
edges for every node of T , F has O(n) vertices and edges.

3.1.5 Extending the c-st numbering


We extend the c-st numbering λ in C to a c-st numbering λ0 in C ∗ such that,
for each cluster ν:
(i) vertices in V (ν) ∪ {`u(ν), `d(ν), ru(ν), rd(ν)} are numbered by λ0 consec-
utively, and
(ii) λ0 (`d(ν)) = λ0 (rd(ν)) < min{λ0 (u) | u ∈ V (ν)}, and max{λ0 (u) | u ∈
V (ν)} < λ0 (`u(ν)) = λ0 (ru(ν)).
To compute the numbering λ0 , we consider the tree T of C, where the leaves
u1 , . . . , un are arranged from left to right in the order of the c-st numbering
λ. We see that, for two consecutive leaves ui and ui+1 , the number δi of new
dummy vertices w that satisfy λ0 (ui ) < λ0 (w) < λ0 (ui+1 ) is 2α − 1, where α is
the number of internal nodes in the path of T between ui and ui+1 . Thus all δi
can be obtained by traversing such paths in O(n) time. Based on this, we can
easily extend the c-st numbering λ to a c-st numbering λ0 of F in O(n) time.

G( ν) G( ν)

lu (ν) ru (ν) lu (ν) ru (ν)

ld (ν) rd (ν) ld (ν) rd (ν)

Figure 7: Forming a rectangle for a cluster.

3.1.6 Find a constrained visibility drawing


Using the dummy vertices `d(ν), `u(ν), rd(ν) and ru(ν) as corners of rectangles,
we can easily deduce the following result.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 16

Theorem 3 Let C = (G, T ) be an n vertex clustered graph with a c-planar


embedding. There is a linear time algorithm which constructs a visibility repre-
sentation of G such that each cluster ν of C can be represented by a rectangle.

Proof: We obtain a visibility representation Γ of F with the vertices and


edges of each cluster ν drawn within a rectangle formed by Γ(`d(ν), `u(ν)),
Γ(rd(ν), ru(ν)) and two line segments (Γ(`d(ν)), Γ(rd(ν))) and (Γ(`u(ν)), Γ(ru(ν))),
as in Figure 7. Since this algorithm preserves the embedding of the input, it is
simple to form the rectangles.
Computing the c-st numbering takes linear time, and gives the y coordinate
of each vertex of G. The algorithm for finding support triangles, given in subsec-
tion 3.1.3, also takes linear time. Extending the graph with dummy vertices and
edges and extending the c-st numbering is trivial. Finding a visibility drawing
(e.g., using the algorithm of [3]) takes linear time. 2

v v

Figure 8: Alignment requirement for a vertex v.

Figure 9: Edge alignment rules.


P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 17

3.1.7 Edge alignment constraints


Theorem 3 does not use the constraints available in the constrained visibility
algorithm. However, looking ahead to the orthogonalization phase, we require
that some edges around a vertex are aligned. In the orthogonalization phase,
only graphs of maximum degree 4 are considered, and so the edge alignment
rules only apply to such graphs. The dummy edges introduced for triangulation
are not needed here, and the edge alignment constraints only apply at the
original vertices of the graph, and at the vertices `u(v), `d(v), ru(v), and rd(v),
of degree 2.
The purpose of the edge alignment constraints is to avoid unnecessary bends
in the orthogonal drawing. For example, suppose that a vertex v has two in-
coming edges and two outgoing edges; then we require that the right incoming
edge is aligned with the left outgoing edge (see Figure 8). The input of the
orthogonalization phase is restricted to clustered graphs C = (G, T ) for which
the vertices in G have maximum degree 4. Thus Figure 9 illustrates all the cases
for our alignment requirements; the edges that are marked by thick lines are
required to be aligned.
All the above alignment requirements together form a complete specification
of the paths that are to be aligned for our visibility representation. Although
some of these paths share common vertices, they do not cross with each other.
This is because there is at most one path going through each original (non-
dummy) vertex of G, and at every dummy vertex, the paths originate from
distinct edges of G and therefore do not cross.
We apply the algorithm Constrained Visibility of [3] to the graph F de-
fined in subsection 3.1.4 with a c-st-numbering and the above requirements for
alignment. In the next phase, we perform orthogonalization operations on this
visibility representation.

3.1.8 Remarks on the visibility phase


The representation provided by Theorem 3 does not depend on the maximum
degree of the graph; it holds for any c-planar clustered graph. Note also that
the triangulation is necessary only for the computation of the c-st numbering
and the support triangles; the dummy edges inserted to make the triangulation
can be omitted after these steps.

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.

3.3 Bend Reduction


In the OGRC drawing obtained from the previous phase, an edge is bent only
near its endpoints. Hence every edge can have at most 3 bends except in the
following case: the edge is between a source of degree 4 and a sink of degree
4 and it has 2 bends near each endpoint (see Figure 11). We show that this 4
bend case can be eliminated by making some adjustments in the drawing.
Note that graph G in a sub-clustered graph C = (G, T ) may have multiple
sources or sinks. For a source or sink u of degree 4 in G, either the leftmost
edge or the rightmost edge gets 2 bends near it, but not both. We say that the

(a) (b) (c)

(d) (e)

(f) (g)

(h) (i)

Figure 10: Orthogonalization rules.


P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 19

leftmost or the rightmost edge of source (or sink) u is an extreme edge of u. An


edge e = (u, v) is a critical edge if e is an extreme edge of both u and v.
Suppose that there is an edge e = (u, v) that has 2 bends near u and another
2 bends near v. Then we fix one end u and rotate the edges around the other
end v, letting the edge e bend only once near v (see Figure 12).
However, this operation creates a new bend in the other edge e0 = (v, w) of
v which may be a critical edge. To avoid this, we construct an auxiliary graph
H from G as follows. Let H be the undirected subgraph induced from G by the
set of critical edges, where all isolated vertices are deleted and directions of the
edges are ignored. Note that the degree of any vertex in H is at most two. This
implies that each connected component in H is either a path or cycle. Thus
there is an assignment σ of direction of edges such that each vertex has at most
one outgoing edge and at most one incoming edge. Let tailσ (e) denote the tail
of a critical edge e in terms of such a direction σ. For each critical edge e, we
apply the above rotation procedure to tailσ (e) if tailσ (e) has 2 bends near it in
the current OGRC drawing. Clearly, after applying the rotation procedure (if
necessary) for all tails tailσ (e), there is no critical edge with four bends.
It is easy to see that the entire procedure for reducing bends can be per-
formed in O(n) time and the final OGRC drawing has an O(n) number of rows
and columns (and hence the height and width are O(n)).

Figure 11: An edge with 4 bends.

v v

e e

u u

Figure 12: Reduce a bend on a critical edge e.


P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 20

3.4 The complete algorithm


The algorithm Orthogonal Grid Rectangular Draw is described as follows.

Algorithm 1 Orthogonal Grid Rectangular Draw


Input: an n vertex connected clustered graph C = (G, T )
of maximum degree at most 4, and a c-planar em-
bedding of C.
Output: a c-planar OGRC drawing of C.
(1) Construct a visibility representation:
(1.1) triangulate G and compute a c-st numbering λ on C;
(1.2) obtain graph F by modifying G to include the dummy vertices for the
rectangles, and compute a c-st numbering λ0 of the resulting clustered
graph C ∗ = (F, T ∗ );
(1.3) apply algorithm Constrained Visibility to F and λ0 .
(2) Construct an OGRC drawing for C from the visibility representation produced
from the previous step, using local operations in Figure 10; obtain rectangles
for clusters from the visibility representation.
(3) Eliminate all the 4 bend edges by using a rotation procedure.
2

For an n vertex clustered graph C = (G, T ), we can triangulate G in O(n)


time and compute a c-st numbering on C in O(n) time. Since algorithm Con-
strained Visibility takes linear time [3] in terms of the size of its input, and
the graph F has O(n) vertices and edges, step (1) of our algorithm takes O(n)
time. Clearly, step (2) takes O(n) time. As noted in Section 3.3, step (3) can
be carried out in O(n) time. These make our algorithm take O(n) time. Since
graph F has O(n) vertices, edges and bends, the height and width of the output
drawing are O(n), as observed in Section 3.3. We summarize the performance
of our algorithm in the following theorem.

Theorem 4 Let C = (G, T ) be an n vertex connected clustered graph of max-


imum degree at most 4, with a c-planar embedding. The algorithm Orthogo-
nal Grid Rectangular Draw constructs in O(n) time a c-planar OGRC drawing
of C with O(n2 ) area, and with at most 3 bends in each edge.
P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 21

A
a1 a2 a3 a4 a5 a6 a7

b1 b2 b3 b4

Figure 13: The sub-clustered-graph I.

4 A Lower Bound for Bends


In this section, we present a class of c-planar embedded clustered graphs of n
vertices, for which every c-planar OGRC drawing requires Ω(n) edges bent more
than twice. This shows that our algorithm Orthogonal Grid Rectangular Draw
is optimal in the worst case (in terms of the number of bends in each edge).
To prove our result, let us first consider a small sub-clustered-graph I (see
Figure 13), which serves as the building block of our cluster graph. There are
two clusters A and B in the sub-clustered-graph I. Cluster A contains vertices
a1 , a2 , . . . , a7 ; cluster B contains vertices b1 , b2 , . . . , b4 . We assume that I has
a fixed c-planar embedding; the orderings of the edges around cluster A and
cluster B are shown in Figure 14. The drawings that we discuss in the rest of
this section are all consistent with this embedding.

1 2 3 4 5 6 7 8 9 10

Figure 14: The embedding for clusters A and B.


P. Eades et al., Drawing Clustered Graphs, JGAA, 3(4) 3–29 (1999) 22

We prove the following lemma.


Lemma 2 In every c-planar OGRC drawing of I, there is at least one edge bent
more than twice.
Proof: In a c-planar OGRC drawing of I, cluster A and B are drawn as disjoint
rectangular regions. Without loss of generality, we assume that the rectangle for
A is drawn above the rectangle for B, and there is a horizontal line ` separating
them. Note that all the edges between A and B have to cross this horizontal
line `, and they cross the line ` in the order shown in Figure 14.
Consider the edge (a4 , b1 ) and the edge (a4 , b4 ), both incident to a4 . Suppose
that the edge (a4 , b1 ) has no bend above the line `; it follows that the other edge
(a4 , b4 ) must have more than 2 bends above the line `. On the other hand, if the
edge (a4 , b1 ) has one bend above the line `, then the other edge (a4 , b4 ) must
have more than one bend above the line `. We deduce that at least one of these
two edges has more than one bend above the line `.
With out loss of generality, let us assume that the edge (a4 , b4 ) has more
than one bend above the line `. Now consider the edge (a4 , b4 ) together with
the edge (a7 , b4 ). We can show that at least one of these has a total of more
than two bends, as follows. If the edge (a4 , b4 ) has a bend below the line `, then
it has more than two bends in total; if the edge (a4 , b4 ) has no bend below the
line `, then the other edge (a7 , b4 ) must have more than two bends below the
line `.
Therefore, we have that there is at least one edge in I that has a total of
more than two bends. 2

Now we define a class of clustered graphs Φn (n = 1, 2, . . .) with sub-


clustered-graph I as the building block. Clustered graph Φn consists of a se-
quence of n copies of the sub-clustered-graph I (see Figure 15). The vertex a7 of
a previous copy of I also serves as the vertex a1 of the next copy of I. Clustered
graph Φn has two clusters An and Bn . Cluster An contains the vertices in the
cluster A of each sub-clustered-graph I; cluster Bn contains the vertices in the
cluster B of each sub-clustered-graph I. Clearly, Φn has 10n + 1 vertices.
By Lemma 2, we have the following theorem.
Theorem 5 In every c-planar OGRC drawing of Φn (n = 1, 2, . . .), there are
at least n edges bent more than twice.

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.

Figure 15: The construction of the clustered graph Φn .

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

Figure 16: Simulation of a degree 10 vertex with a cluster.

extended to such graphs by simulating the larger degree vertices with


clusters; for example, the cluster in Figure16 simulates a vertex of degree
10. It would be interesting to analyze this simulation. However, it is clear
that such a simulation increases the area of the drawing. It would be
useful to investigate whether the methods for solving the related problem
classical graphs [8, 18] can be extended to clustered graphs.

Finally, as a byproduct of our modification from a clustered graph C =


(G, T ) to an extended clustered graph C ∗ = (F, T ∗ ) in Section 3.1, we present
a new result in planar straight-line drawings of clustered graphs. In a planar
straight-line drawing of a clustered graph C = (G, T ), edges are required to be
drawn as straight-lines and clusters must be drawn as convex polygons. The
question of whether every c-planar clustered graph admits a planar straight-
line drawing or not has been studied and answered affirmatively [9, 10, 14].
However, it is still open whether or not more regular convex bodies such as
circles and rectangles can be used for clusters in a planar straight-line drawing.
The results of this paper together with those in [9, 10] imply that a c-planar
clustered graph C = (G, T ) admits a planar straight-line drawing with clusters
drawn as trapezoids, as follows.
We use the extended clustered graph C ∗ = (F, T ∗ ) of C defined in Sec-
tion 3.1. Results in [9, 10] imply that for a given c-planar clustered graph
C = (G, T ) and its c-st numbering λ, there is a planar straight-line drawing of
C with the following properties:
(i) the y-coordinate of each vertex u is its c-st number λ(u), and

(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

By applying this result to the clustered graph C ∗ extended from C and a


c-st numbering λ0 on C ∗ , we can obtain a planar straight-line drawing of C ∗
in which the convex polygon for each cluster ν is a trapezoid formed by its
dummy vertices `d(ν), `u(ν), rd(ν) and ru(ν) (since λ0 (`d(ν)) = λ0 (`u(ν)) and
λ0 (rd(ν)) = λ0 (ru(ν))). This implies the following result.

Corollary 1 Let C = (G, T ) be a c-planar clustered graph with n vertices. A


planar straight-line drawing of C in which each cluster is drawn as a trapezoid
can be constructed in O(n) time.

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

[34] A. Papakostas and I. G. Tollis. A pairing technique for area-efficient or-


thogonal drawings. In Stephen C. North, editor, GD’96, volume 1190 of
Lecture Notes in Computer Science, pages 355–370. Springer-Verlag, 1997.
[35] D. Reiner, G. Brown, M. Friedell, J. Lehman, R. McKee, P. Rheingans, and
A. Rosenthal. A database designer’s workbench. In S. Spaccapietra, editor,
Entity-Relationship Approach: Proc. 5th Int. Conf. on Entity-Relationship
Approach (Dijon France 1987), pages 347–360, New York, N.Y., 1987.
North-Holland.
[36] P. Rosenstiehl and R.E. Tarjan. Rectilinear planar layouts and bipo-
lar orientations of planar graphs. Discrete and Computational Geometry,
1(4):343–353, 1986.
[37] B. Schieber and U. Vishkin. On finding lowest common ancestors: simpli-
fication and parallelization. SIAM J. Computing, 17:1253–1262, 1988.
[38] K. Sugiyama and K. Misue. Visualization of structural information: Au-
tomatic drawing of compound digraphs. IEEE Transactions on Systems,
Man and Cybernetics, 21(4):876–892, 1991.
[39] K. Sugiyama and K. Misue. Visualization of structural information: Au-
tomatic drawing of compound digraphs. IEEE Transactions on Software
Engineering, 21(4):876–892, 1991.
[40] R. Tamassia. New layout techniques for entity-relationship diagrams. In
Proc. 4th Int. Conf. on Entity-Relationship Approach, pages 304–311, 1985.
[41] R. Tamassia. On embedding a graph in the grid with the minimum number
of bends. SIAM J. Computing, 16(3):421–444, 1987.
[42] R. Tamassia, G. Di Battista, and C. Batini. Automatic graph drawing
and readability of diagrams. IEEE Transactions on Systems, Man and
Cybernetics, SMC-18(1):61–79, 1988.
[43] R. Tamassia and I.G. Tollis. A unified approach to visibility representations
of planar graphs. Discrete and Computational Geometry, 1(4):321–341,
1986.
[44] R. Tamassia and I.G. Tollis. Efficient embedding of planar graphs in linear
time. In Proc. IEEE Int. Symp. on Circuits and Systems, pages 495–498,
1987.

[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

[47] J.D. Ullman. Computational Aspects of VLSI. Principles of Computer


Science. Computer Science Press, Rockville, Md., 1984.
[48] L. Valiant. Universality considerations in VLSI circuits. IEEE Transactions
on Computers, C-30(2):135–140, 1981.
[49] C. Williams, J. Rasure, and C. Hansen. The state of the art of visual
languages for visualization. In Visualization 92, pages 202 – 209, 1992.
[50] R. Wirfs-Brock, B. Wilkerson, and L. Wiener. Designing Object-Oriented
Software. P T R Prentice Hall, Englewood Cliffs, NJ 07632, 1990.
Journal of Graph Algorithms and Applications
http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 4, pp. 31–62 (1999)

A Linear Algorithm for Bend-Optimal


Orthogonal Drawings of Triconnected Cubic
Plane Graphs
Md. Saidur Rahman, Shin-ichi Nakano and Takao Nishizeki
Graduate School of Information Sciences
Tohoku University
Aoba-yama 05, Sendai 980-8579, Japan
http://www.nishizeki.ecei.tohoku.ac.jp/
saidur@nishizeki.ecei.tohoku.ac.jp, nakano@ecei.tohoku.ac.jp,
nishi@ecei.tohoku.ac.jp

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.

Communicated by Giuseppe Di Battista and Petra Mutzel.


Submitted: March 1998. Revised: November 1998 and March 1999.
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 32

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)

Figure 1: Illustration of our algorithm.


M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 34

with bends, we finally obtain an orthogonal drawing of G as shown in Fig. 1(b).


The rest of the paper is organized as follows. Section 2 gives some definitions
and presents preliminary results. Section 3 presents an algorithm to find an
orthogonal drawing in which the number of bends may not be the minimum but
does not exceed the minimum number by more than four. Section 4 presents an
algorithm to find an orthogonal drawing with the minimum number of bends,
modifying the algorithm in Section 3. Section 5 presents bounds on the grid
size of our orthogonal drawing on the plane grid. Finally Section 6 concludes
the paper. A preliminary version of the paper was presented in [7].

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

is a descendant cycle of C 0 and C 0 is an ancestor cycle of C 00 if C 00 is contained


in G(C 0 ). We also say that a descendant cycle C 00 of C 0 is a child-cycle of C 0 if
C 00 is not a descendant cycle of any other descendant cycle of C 0 . In Fig. 2(a)
cycles C1 , C2 , · · · , C7 are the descendant cycles of C, cycles C1 , C2 , · · · , C5 are
the child-cycles of C, and cycles C6 and C7 are the child-cycles of C4 . We now
have the following lemma.
Lemma 1 Let C be a 3-legged cycle in a 3-connected cubic plane graph G. Then
the child-cycles of C are independent of each other.
Proof: Suppose for a contradiction that a pair of distinct child-cycles C1 and
C2 of C are not independent. Then C1 and C2 have a common vertex. However,
either cannot be a descendant cycle of the other since both are child-cycles of C.
Therefore C2 has a vertex in G(C1 ) and a vertex not in G(C1 ). Thus C2 must
pass through two of the three legs of C1 . Let v be the leg-vertex of the other
leg of C1 . Similarly, C1 must pass through two of the three legs of C2 . Let w
be the leg-vertex of the other leg of C2 . Then removal of v and w disconnects
G, contrary to the 3-connectivity of G. 2
Lemma 1 implies that the containment relation among cycles in CC is rep-
resented by a tree as illustrated in Fig. 2(b); the tree is called the genealogical
tree of C and denoted by TC .
We have the following two lemmas.

C
1

C2

C4 C
C5
C7 C6
C1 C2 C3 C4 C5

C3 C6 C7

(b)
C

(a)

Figure 2: (a) Cycles in CC and (b) genealogical tree TC .

Lemma 2 Let C be a 3-legged cycle in a 3-connected cubic plane graph G. Then


|CC | ≤ n(G(C))/2.
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 36

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

Lemma 3 Let C be a 3-legged cycle in a 3-connected cubic plane graph G. Then


the genealogical tree TC can be found in linear time.

Proof: We outline an algorithm to find all 3-legged cycles in CC and construct


TC in linear time. We first traverse the contour of each inner face of G(C)

C
1
C2
C9

C8
C4

C5
C7 C6

C3

Figure 3: Illustration for the proof of Lemma 3.

containing an outer edge of G(C) as illustrated in Fig. 3, where the traversed


contours of faces are indicated by dotted lines. Clearly each outer edge of G(C)
is traversed exactly once, and each inner edge of G(C) is traversed at most twice.
The inner edges of G(C) traversed exactly once form cycles, called singly traced
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 37

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

vertex of degree two


vertex of degree three

C
3

C 5 C7
C2
C4
C1

C6

(a) 1-legged cycle (b) 2-legged cycles (c) 3-legged cycles

Figure 4: Bad cycles C1 , C2 , C3 and C5 , and non-bad cycles C4 , C6 and C7 .

(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).

Fact 6 At least one bend must appear on each 3-legged cycle in G.


M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 39

An outline of our algorithm is as follows.


Let G0 be a graph obtained from G by adding four dummy vertices a, b, c and
d of degree two on Co (G) as follows. If there are four or more edges on Co (G),
then add four dummy vertices on any four distinct edges on Co (G), one for each.
If there are exactly three edges on Co (G), then add two dummy vertices on any
two distinct edges on Co and two dummy vertices on the remaining edge.
If the resulting graph G0 has no bad cycle, then by Lemma 4 G0 has a
rectangular drawing, in which the four dummy vertices become the corners of
the rectangle corresponding to Co (G0 ). From the rectangular drawing of G0 one
can immediately obtain an orthogonal drawing of G with exactly four bends by
replacing the four dummy vertices with bends at the corners. By Fact 5 the
orthogonal drawing of G has the minimum number of bends.
Thus we may assume that G0 has a bad cycle. Since G has no 1- or 2-legged
cycle, every bad cycle in G0 is a 3-legged cycle containing no dummy vertex of
degree two like C5 in Fig. 4(c). A bad cycle C in G0 is defined to be maximal
if C is not contained in G0 (C 0 ) for any other bad cycle C 0 in G0 . In Fig. 5(a)
C1 , C2 , · · · , C6 are the bad cycles, C1 , C2 , · · · , C4 are the maximal bad cycles
in G0 , and C5 and C6 are not maximal bad cycles since they are contained in
G0 (C4 ). The 3-legged cycle C7 indicated by a dotted line in Fig. 5(a) is not a
bad cycle in G0 since it contains a dummy vertex a. Since G is a 3-connected
cubic plane graph, all maximal bad cycles in G0 are independent of each other
similarly as in Lemma 1. Let C1 , C2 , · · · , Cl be the maximal bad cycles in G0 .
(In Fig. 1(c) l = 2, and in Fig. 5(a) l = 4.) Let G00 be the graph obtained from
G0 by contracting G0 (Ci ) into a single vertex vi for each maximal bad cycle
Ci , 1 ≤ i ≤ l, as illustrated in Figs. 1(d) and 5(b). Clearly G00 has no bad
cycle. We find a rectangular drawing of G00 , and recursively find a “suitable”
orthogonal drawing of G0 (Ci ), 1 ≤ i ≤ l, with the minimum number of bends,
defined later and called a feasible drawing, and finally patch them to get an
orthogonal drawing of G. (See Figs. 1, 5 and 12.)
We define the following terms for each 3-legged cycle C in G in a recursive
manner based on its genealogical tree TC . Each 3-legged cycle C in G is divided
into three paths P1 , P2 and P3 by the three leg-vertices x, y and z of C as
illustrated in Fig. 6. These three paths P1 , P2 and P3 are called the contour
paths of C. Each contour path of C is classified as either a green path or a red
path. In addition, we assign an integer bc(C), called the bend-count of C, to each
3-legged cycle C in G. We will show later that G(C) has an orthogonal drawing
with bc(C) bends and has no orthogonal drawing with fewer than bc(C) bends,
that is b(G(C)) = bc(C). Furthermore we will show that, for any green path
of C, G(C) has an orthogonal drawing with bc(C) bends including a bend on
the green path. On the other hand, for any red path of C, G(C) does not have
any orthogonal drawing with bc(C) bends including a bend on the red path.
We define the bc(C), red paths and green paths in a recursive manner on the
genealogical tree TC , as follows.
Let C be a 3-legged cycle in G, and let C1 , C2 , · · · , Cl in CC be the child-
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 40

v2
a C2 a

C1 b b
v1
C7

v3
C3
v4
C6
C5
C4
d d
c c

dummy vertex (a) G (b) G


original vertex
contracted vertex

Figure 5: G0 and G00 .

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

Figure 6: Green paths.

bends have no bend on C and hence we need to introduce a new bend on C


in an orthogonal drawing of G(C). In Fig. 6(b) the three green paths of C are
indicated by dotted lines.)
Case 3: Otherwise (see Fig. 6(c)).
In this case at least one of the child-cycles C1 , C2, · · · , Cl , for example C1 , C4
and C5 in Fig. 6(c), has a green path on C. Classify a contour path Pi , 1 ≤ i ≤ 3,
of C as a green path if a child-cycle of C has its green path on Pi . Otherwise,
classify Pi as a red path. Thus at least one of P1 , P2 and P3 is a green path.
We set
l
X
bc(C) = bc(Ci ). (3)
i=1

(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 8 Let C be a 3-legged cycle in G. Then the classification and assign-


ment for all descendant cycles of C can be done in linear time, that is, in time
O(n(G(C))), where n(G(C)) is the number of vertices in G(C).

Proof: By Lemma 3 TC can be found in linear time. Using TC , the classification


and assignment for all descendant cycles of C can be done in linear time. 2
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 42

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

Conversely proving b(G(C)) ≤ bc(C), we have b(G(C)) = bc(C) for any 3-


legged cycle C in G. Indeed we will prove a stronger claim later in Lemmas 11
and 12 after introducing the following definition.
Let x, y and z be the three leg-vertices of C in G. One may assume that x, y
and z appear on C in clockwise order. For a green path P with ends x and y on
C, an orthogonal drawing of G(C) is defined to be feasible for P if the drawing
satisfies the following properties (p1)–(p3):

(p1) The drawing of G(C) has exactly bc(C) bends.


(p2) At least one bend appears on the green path P .
(p3) The drawing of G(C) intersects none of the the following six open halflines.

• the vertical open halfline with the upper end at x.


• the horizontal open halfline with the right end at x.
• the vertical open halfline with the lower end at y.
• the horizontal open halfline with the left end at y.
• the vertical open halfline with the upper end at z.
• the horizontal open halfline with the left end at z.

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 .

Proof: We give a recursive algorithm to find an orthogonal drawing of G(C)


feasible for P , as follows. There are three cases to consider.
Case 1: C has no child-cycle (see Fig. 6(a)).
In this case bc(C) = 1 by (1). We insert, as a bend, a dummy vertex t
of degree two on an arbitrary edge on the green path P in graph G(C), and
let F be the resulting graph. Then every vertex of F has degree three except
four vertices of degree two: the three leg-vertices x, y and z, and the dummy
vertex t. Since C has no child-cycle, trivially F has no bad cycle. Therefore
by Algorithm Rectangular-Draw in [8] one can find a rectangular drawing
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 44

y
y

z z
x
x

bend on P
3-legged cycle C
the six halflines in property (p3)

Figure 7: An example of a feasible drawing.

of F with four corners on x, y, z and t. The drawing of F immediately yields


an orthogonal drawing of G(C) having exactly one bend at t, in which C is a
rectangle. Thus the drawing satisfies (p1)–(p3), and hence is feasible for P .
Case 2: None of the child-cycles of C has a green path on C (see Fig. 6(b)).
Let C1 , C2 , · · · , Cl be the child-cycles of C, where l ≥ 1. First, for each i,
1 ≤ i ≤ l, we choose an arbitrary green path of Ci , and find an orthogonal
drawing D(G(Ci )) of G(Ci ) feasible for the green path in a recursive manner.
Next, we construct a plane graph F from G(C) by contracting each G(Ci ),
1 ≤ i ≤ l, to a single vertex vi . Fig. 8(a) illustrates F for the graph G(C) in
Fig. 6(b) where the green path P is assumed to be P1 . One or more edges on
P are contained in none of Ci , 1 ≤ i ≤ l, and hence these edges remain in F .
Add a dummy vertex t on any of these edges of P as shown in Fig. 8(b), and
let H be the resulting plane graph. All vertices of H have degree three except
the four vertices x, y, z and t on Co (H) of degree two, and H has no bad cycle.
Therefore, by Rectangular-Draw, we can find a rectangular drawing D(H) of
H with four corners on x, y, z and t. D(H) immediately yields an orthogonal
drawing of F with exactly one bend at t. Fig. 8(c) illustrates a rectangular
drawing of H for C and P = P1 in Fig. 6(b).
Finally, as explained below, patching the drawings D(G(C1 )), D(G(C2 )),
· · · , D(G(Cl )) into D(H), we can construct an orthogonal drawing of G(C) with
P
bc(C) = 1 + li=1 bc(Ci ) bends (see Fig. 8). As illustrated in Fig. 9(b), there are
twelve distinct embeddings of a contracted vertex vi and the three legs incident
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 45

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

Figure 8: F , H, D(H) and D(G(C)) for Case 2.

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

any green path P on C, at least one of C1 , C2 , · · · , Cl has a green path on P .


One may assume without loss of generality that C1 has a green path Q on the
green path P of C, that the three leg-vertices x1 , y1 and z1 of C1 appear on C1
clockwise in this order, and that x1 and y1 are the ends of Q as illustrated in
Fig. 6(c).
We first construct a plane graph F from G(C) by contracting each G(Ci ), 1 ≤
i ≤ l, to a single vertex vi . Fig. 10(a) illustrates F for G(C) in Fig. 6(c). Replace
v1 in F with a quadrangle x1 ty1 z1 as shown in Fig. 10(b) where t is a dummy
vertex of degree two, and let H be the resulting plane graph. Thus all vertices
of H have degree three except four vertices on Co (H) of degree two: the dummy
vertex t and the three leg-vertices x, y and z of C. Furthermore H has no bad
cycle. Therefore, by Rectangular-Draw, we can find a rectangular drawing
D(H) of H with four corners on t, x, y and z, in which the contour x1 ty1 z1 of a
face is drawn as a rectangle. Fig. 10(c) illustrates a rectangular drawing of H
for G(C) in Fig. 6(c).
We next find feasible orthogonal drawings D(G(C1 )), D(G(C2 )), · · ·,
D(G(Cl )) in a recursive manner; D(G(C1 )) is feasible for the green path Q, and
D(G(Ci )) is feasible for an arbitrary green path of Ci for each i, 2 ≤ i ≤ l.
Finally, patching the drawings D(G(C1 )), D(G(C2 )), · · · , D(G(Cl )) into
D(H), we can construct an orthogonal drawing D(G(C)) of G(C) feasible for P ;
we replace the rectangle x1 ty1 z1 of D(H) by D(G(C1 )), and replace each vertex
vi , 2 ≤ i ≤ l, by D(G(Ci )). In this case C is not always a rectangle in D(G(C)).
One can observe with the help of Fig. 9 that each of the replacement above
can be done without introducing any new bend or edge-crossing and without
any conflict of coordinates of vertices as illustrated in Fig. 10. Note that the
resulting drawing always expands outwards, satisfying the property (p3). Since
we replace the rectangle x1 ty1 z1 in D(H) by D(G(C1 )) and we have already
counted the bend corresponding to t for C1 , we need not count it for Pl C. Thus
one can observe that the drawing D(G(C)) has exactly bc(C) = i=1 bc(Ci )
bends. Since a bend of D(G(C1 )) appears on Q, the bend appears on the green
path P of C in D(G(C)). Hence D(G(C)) is an orthogonal drawing feasible for
P. 2
The definition of a feasible orthogonal drawing and Lemmas 10 and 11 im-
mediately imply the following Lemma 12.

Lemma 12 For any 3-legged cycle C in G, b(G(C)) = bc(C), and a feasible


orthogonal drawing of G(C) has the minimum number b(G(C)) of bends.

The algorithm for finding a feasible orthogonal drawing of G(C) described


in the proof of Lemma 11 above is hereafter called Feasible-Draw. We have
the following lemma on Feasible-Draw.

Lemma 13 Algorithm Feasible-Draw finds a feasible orthogonal drawing of


G(C) for a 3-legged cycle C in linear time, that is, in time O(n(G(C))).
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 48

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

Figure 10: F , H, D(H) and D(G(C)) for Case 3.

Proof: Denote by TRG (G) the computation time of Rectangular-Draw(G).


Since TRG (G) = O(n) [8], there is a constant c such that

TRG (G) ≤ c · m(G) (4)

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

T (G(C)) ≤ c · m(G(C)) + 4 · c · |CC |. (5)

We prove (5) by induction based on TC .


First consider the case where C has no child-cycle. Then |CC | = 1. In this
case Feasible-Draw adds a dummy vertex on C to obtain a graph F from G(C).
Therefore m(F ) = m(G(C)) + 1. Feasible-Draw finds a rectangular drawing
of F by Rectangular-Draw. Hence, by (4) we have T (G(C)) = TRG (F ) ≤
c · m(F ). Thus T (G(C)) ≤ c · m(G(C)) + 4 · c · |CC |, as desired.
Next consider the case where C has child-cycles C1 , C2 , · · · , Cl where l ≥ 1.
Suppose inductively that (5) holds for each Ci , 1 ≤ i ≤ l:

T (G(Ci )) ≤ c · m(G(Ci )) + 4 · c · |CCi |. (6)

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 H
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.
Therefore one can observe that
l
X
m(H) + m(G(Ci )) ≤ m(G(C)) + 4. (7)
i=1

Algorithm Feasible-Draw recursively finds drawings of G(Ci ), 1 ≤ i ≤ l, and


patches them into a rectangular drawing D(H) of H found by Rectangular-
Draw. Therefore we have
l
X
T (G(C)) = TRG (H) + T (G(Ci )). (8)
i=1

By (4) we have

TRG (H) ≤ c · m(H). (9)

Using (6), (7), (8) and (9), we have


l
X
T (G(C)) ≤ c · m(H) + (c · m(G(Ci )) + 4 · c · |CCi |)
i=1
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 50

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

By using (10) and (11), we have


T (G(C)) ≤ c · (m(G(C)) + 4) + 4 · c · (|CC | − 1) = c · m(G(C)) + 4 · c · |CC |.

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.

Figure 11: Algorithm Orthogonal-Draw.

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 .

We now have the following theorem.

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).

Proof: (a) Number of bends.


There are two cases.
Case 1: G0 has no bad cycle.
In this case we have a drawing with exactly four bends. By Fact 5 it is a
drawing with the minimum number of bends.
Case 2: Otherwise.
Let C1 , C2 , · · · , Cl be the maximal bad cycles in G0 . For each i, 1 ≤ i ≤ l,
an orthogonal drawing D(G(Ci )) feasible for an arbitrary green path of Ci has
exactly bc(Ci ) bends. Furthermore the rectangular drawing D(G00 ) has exactly
four bends corresponding to the four dummy vertices. Algorithm Orthogonal-
Drawing patches the drawings D(G(C1 )), D(G(C2 )), · · · , D(G(Cl )) into D(G00 )
to get an orthogonalP drawing of G. Therefore we have an orthogonal drawing of
l
G with exactly 4 + i=1 bc(Ci ) bends. Since the 3-legged cycles C1 , C2 , · · · , Cl
Pl
are independent of each other, by Lemma 9 G has at least i=1 bc(Ci ) vertex-
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 52

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.

Lemma 14 Let Ci0 be a corner cycle of a 3-connected cubic plane graph G.


Then none of the child-cycles of Ci0 has a green path on Ci0 , and all contour
paths of Ci0 are green. (See Fig. 15 where Ci0 is indicated by a dotted line.)
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 53

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.

Figure 13: Algorithm Minimum-Bend.


M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 54

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)

Figure 14: Illustration for Algorithm Minimum-Bend.


M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 55

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.

We now have the following theorem.


Theorem 2 Algorithm Minimum-Bend produces an orthogonal drawing of a
3-connected cubic plane graph G with the minimum number b(G) of bends in
linear time. Furthermore, we have
k
X l
X
b(G) = bc(Ci0 ) + bc(Ci ) + 4 − k, (12)
i=1 i=1
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 56

where k, C10 , C20 , · · · , Ck0 and C1 , C2 , · · · , Cl are defined as in algorithm Minimum-


Bend.
Proof: (a) Number of bends.
We first show that Minimum-Bend(G) produces an orthogonal drawing of
Pk Pl
G with exactly i=1 bc(Ci0 ) + i=1 bc(Ci ) + 4 − k bends. For each i, 1 ≤ i ≤ k,
an orthogonal drawing D(G(Ci0 )) feasible for Pi0 has exactly bc(Ci0 ) bends. Also,
for each i, 1 ≤ i ≤ l, an orthogonal drawing D(G(Ci )) feasible for an arbitrary
green path of Ci has exactly bc(Ci ) bends. The rectangular drawing D(G00 )
has exactly four dummy vertices t01 , t02 · · · , t0k and t1 , t2 · · · , t4−k of degree two,
as illustrated in Fig. 14(e). Algorithm Minimum-Bend patches 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 of G. The rectangle x0i t0i yi0 zi0 in D(G00 )
is replaced by D(G(Ci0 )) for each i, 1 ≤ i ≤ k as illustrated in Fig. 14(g), and
the bend corresponding to t0i in the final drawing has been counted by bc(Ci0 ).
Therefore only t1 , t2 , · · · , t4−k among the four dummy vertices in G00 should be
counted as bends with Co (G) in the final drawing. Thus the final orthogonal
Pk Pl
drawing of G has exactly i=1 bc(Ci0 ) + i=1 bc(Ci ) + 4 − k bends.
Pk Pl
Thus it suffices to show that b(G) ≥ i=1 bc(Ci0 ) + i=1 bc(Ci ) + 4 − k.
There are two cases.
Case 1: k = 4.
Since cycles C10 , C20 , · · · , Ck0 and C1 , C2, · · · , Cl are independent of each other
Pk Pl
in G, by Lemma 9 G has at least i=1 bc(Ci0 ) + i=1 bc(Ci ) vertex-disjoint 3-
Pk Pl Pk
legged cycles. Thus by Fact 6 b(G) ≥ i=1 bc(Ci0 )+ i=1 bc(Ci ) = i=1 bc(Ci0 )+
Pl
i=1 bc(Ci ) + 4 − k.
Case 2: k ≤ 3.
For a corner cycle Ci0 , 1 ≤ i ≤ k, let Ci1 0 0
, Ci2 , · · · , Cil0 i be the child-cycles
0 0 0
of Ci in CCi where li ≥ 0. By Lemma 14 all three contour paths Pi1 , Pi2 and
Pi3 of Ci are green, and none of Ci1 , Ci2, · · · , Cili has a green path on Ci0 . (In
0 0 0 0 0

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

corner cycle of G and hence G would have k +1 (≤ 4) independent corner cycles,


a contradiction. Therefore only a red path of Ci can be on Co (G). However, by
Lemma 9, G(Ci ) has bc(Ci ) vertex-disjoint 3-legged cycles of G which do not
contain any edge on red paths of Ci . Hence these bc(Ci ) cycles in G(Ci ) do not
contain any edge on Co (G).
Pk 0
Pl
Thus G has i=1 (bc(Ci ) − 1) + i=1 bc(Ci ) vertex-disjoint 3-legged cy-
cles which do not contain any edge on Co (G) since cycles C10 , C20 , · · · , Ck0 and
P1k, C2 , · · · ,0Cl are independent
C Pl of each other. Therefore by Fact 6 at least
i=1 (bc(C i ) − 1) + i=1 bc(C i bends must appear in the proper inside of
)
Co (G). By Fact 5 at least four bends must appear on Co (G). Thus we have
Pk Pl Pk Pl
b(G) ≥ i=1 (bc(Ci0 )−1)+ i=1 bc(Ci ) +4 = i=1 bc(Ci0 )+ i=1 bc(Ci ) +4 −k.
This completes a proof of (12).
(b)Time complexity.
Similar to (b) in the proof of Theorem 1. 2

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].

Lemma 15 Any rectangular drawing of a plane graph G produced by Algorithm


Rectangular-Draw can be transformed to a rectangular grid drawing on a grid
M. S. Rahman et al., Orthogonal Drawings, JGAA, 3(4) 31–62 (1999) 58

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.

Lemma 16 Let C be a 3-legged cycle in a 3-connected cubic plane graph G.


Then an orthogonal drawing of G(C) produced by Algorithm Feasible-Draw
can be transformed to an orthogonal grid drawing on a grid such that W ≤
n(G(C))−1
2
and H ≤ n(G(C))−1
2
.

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

From (17) and (18) we have W ≤ n(G(C))−12 .


We now consider the case where F 0 is constructed from F by replacing
exactly one contracted vertex on Co (F ) by a quadrangle. In this case n(F 0 ) =
n(F ) + 3. As in the former case, 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. During the patching operation one of G(Ci ), 1 ≤ i ≤ l,
say G(C1 ), replaces the quadrangle, and each G(Ci ), 2 ≤ i ≤ l replaces exactly
one contracted vertex in F 0 . Furthermore, any drawing of a quadrangle on a
grid has width at least one. Therefore the following equation holds:
l
X
W ≤ WF 0 + (W1 − 1) + Wi , (19)
i=2

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

From (14), (19) and (20) we have,


l
X n(G(Ci )) − 1
n(F ) + 1 n(G(C1 )) − 1
W ≤ + −1+
2 2 2
i=2
Pl
n(F ) + i=1 (n(G(Ci )) − 1) − 1
= . (21)
2
Clearly
l
X
n(F ) + (n(G(Ci )) − 1) = n(G(C)). (22)
i=1
n(G(C))−1
From (21) and (22) we have W ≤ 2 . 2
We are now ready to show W ≤ n2 and H
≤ n2 for a grid required for an
orthogonal grid drawing corresponding to an orthogonal drawing of G produced
by Minimum-Bend. We here use the same notations used in Minimum-
Bend. By Lemma 15, the rectangular drawing of G00 has a corresponding
00
rectangular grid drawing on a grid such that WG00 + HG00 ≤ n(G )
2 , where WG
00

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

One can observe that


k
X l
X
n(G00 ) + (n(G(Ci0 )) − 3) + (n(G(Ci )) − 1) − 4 = n. (26)
i=1 i=1

n n
From (25) and (26) we have W ≤ 2. Similarly we can prove H ≤ 2. Thus we
have the following theorem.

Theorem 3 Let G be a 3-connected cubic plane graph with n vertices. Any


orthogonal drawing of G with the minimum number b(G) of bends produced by
Algorithm Minimum-Bend has a corresponding orthogonal grid drawing on a
grid with width H and height H such that W + H ≤ b(G) + 12 n − 2, W ≤ n2 and
H ≤ n2 .

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.

Acknowledgement: We wish to thank the three anonymous referees for their


valuable comments and suggestions for improving the presentation of the paper.

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)

Bounds for Orthogonal 3-D Graph Drawing


T. Biedl
School of Computer Science, McGill University
Montreal, PQ H3A2A7, Canada

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.

Communicated by G. Di Battista and P. Mutzel.


Submitted: February 1998. Revised: November 1998.

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.

Figure 1: Two boxes joined by a 4-bend edge.


T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 65

1.1 Focus of this paper


The focus of this paper is on establishing upper and lower bounds for the volume
and the number of bends of 3-D orthogonal grid drawings. In particular, we give
upper bounds on the volume that depend on the allowed maximum number of
bends per edge. More useful than upper and lower bounds would be an algorithm
that computes for an arbitrary input graph an embedding that minimizes volume
or number of bends. However, the problem of bend minimization or volume
minimization is apparently computationally intractable. See [8].
We exclusively study embeddings of the complete graph Kn for the following
reason. Any simple graph G on n vertices is a subgraph of the complete graph
Kn . Thus, a drawing of Kn immediately provides a drawing for G by deleting
irrelevant edges. Consequently, upper bounds for Kn yield upper bounds for all
other simple graphs on n vertices. Furthermore, no simple graph on n vertices
can yield larger lower bounds than Kn .
Since our focus is on bounds, our constructions are not designed with the
intention of giving attractive looking drawings. In particular, vertex boxes may
be degenerate as previously described. Such degeneracies may be easily removed
from a drawing by inserting extra axis-aligned planes of grid points. This in-
creases the volume of a drawing by a multiplicative constant and does not affect
the order of the upper bound.
The boxes produced by our upper bound constructions can be poorly pro-
portioned in two respects. The surface area can be large relative to the degree
of the vertex. Also, the vertex boxes can be far from cube-shaped. Algorithms
that proportion vertices better have recently been presented in [20], [1].

1.2 Relation to other work


The problem of embedding a graph in a rectangular grid has been addressed
in the context of VLSI design (see [16] for an overview). However, the objec-
tives of graph drawing and those of VLSI, while similar, are often prioritized
differently. For example, while bend (or “jog”) minimization within layers is an
issue in circuit layout design, apparently this cost measure does not have a high
priority (see [16, p. 222]). By contrast, in graph drawing, the notion that bend
minimization is important for diagram readability has been widely accepted
([21] provides some experimental evidence for this). Another difference between
graph drawing and VLSI is that in 3-D VLSI design one of the dimensions is
radically different from the other two: connections between layers (“vias”) are
undesirable, whereas bends within a layer (“jogs”) are of minor importance.
Also, one of the dimensions is usually restricted to a small number of layers.
In 3-D graph drawing there are no such differences between directions. With
advances in fabrication technology, it has become practical for VLSI design to
use more than two or three layers; hence our results may nevertheless be of
interest in that field.
In the field of graph drawing, for graphs drawn orthogonally in the 2-D grid,
early research mainly considered graphs of maximum degree 4 and represented
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 66

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.

1.3 Results of this paper


Our results concern volume and number of bends for 3-D orthogonal grid draw-
ings. Since we give upper and lower bounds, we first explain what functions are
being bounded, and then we state the results.
convention: From now on, the terms drawing and 3-D orthogonal grid drawing
are used interchangeably.
Let vol(n) denote the minimum, taken over all drawings of Kn , of the vol-
umes of the drawings. Here, there are no restrictions on these drawings of
Kn , other than that they are understood, by the above convention, to be 3-D
orthogonal grid drawings.
Similarly, let volk (n) denote the minimum, taken over all drawings of Kn
that have k or fewer bends on any edge, of the volumes of the drawings. Let
bend(n) denote the minimum, taken over all drawings of Kn , of the total number
of bends in the drawings.
main results: Our main results are that
• vol(n) ∈ Θ(n2.5 );
• vol1 (n) and vol2 (n) ∈ O(n3 );
• for k ≥ 3, volk (n) ∈ Θ(n2.5 ); and
• bend(n) ∈ Θ(n2 ).
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 67

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 ).

Proof: Consider a drawing of Kn in a grid of dimensions X × Y × Z. Let


0 < ε < 14 be given and choose 0 < δ < 14 so small that 14 (1 − 4δ)5/2 > 14 − ε.
We distinguish three cases.
Case 1: A line intersects many vertices
Assume that there exists a z-line intersecting at least 2δn vertices. Set
t = d2δne, and let v1 , . . . , vt be any t of the vertices intersected by the z-line,
listed in order of occurrence along the line. Let z0 be a not necessarily integer
z-coordinate such that the (z = z0 )-plane intersects none of these t vertices and
separates the first b 2t c of them from the remaining d 2t e. See the top left picture
in Fig. 2.
Since the b 2t c·d 2t e ≥ 14 t2 −1 edges connecting these two groups must cross the
(z = z0 )-plane, this plane must contain at least 14 t2 − 1 points having integer x-
and y-coordinates. Hence XY ≥ 14 t2 − 1. Also, Z ≥ t since the z-line intersects
at least t vertices. Thus XY Z ≥ 14 t3 − t ≥ 2δ 3 n3 − 2δn ∈ Θ(n3 ).
Case 2: A plane intersects many vertices
Assume now that no x-line, y-line or z-line intersects as many as 2δn vertices,
but that there exists a (z = z0 )-plane intersecting at least (1 − 2δ)n vertices.
A vertex is left of an (x = x0 )-plane if all the points in its grid box have x-
coordinates less than x0 . The notion of right of an (x = x0 )-plane is analogous.
As an (x = x0 )-plane is swept from smaller to larger values of x0 , the y-line
determined by the intersection of this (x = x0 )-plane with the (z = z0 )-plane
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 68

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

2.2 A lower bound on the bends


Recall that bend(n) is the minimum possible number of bends 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 that bend(n) is
in Ω(n2 ).
To prove this result, we use the fact that there exist graphs that have no
0-bend 3-D orthogonal drawing [11]. We present here a simple proof of this fact.
If no bends are permitted in the drawing, then the edges correspond to axis-
parallel visibility lines between pairs of boxes. Such visibility representations
have been studied in 2-D by Wismath [26], [15] and by Tamassia and Tollis
[24], and in 3-D with 2-D objects in [4], [10], [11]. A 3-D orthogonal drawing
of a graph with no bends splits the edges into three classes, depending on the
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 69

Figure 2: Cases 1,2,3 for the lower bound.

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 ).

Theorem 2 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 Drawings of O(n3 ) volume for k = 1


In this section, we describe two strategies to draw Kn with at most k = 1 bend
on any edge. For simplicity, we assume in the description of our constructions
that n is divisible by 4. When this is not the case, slightly modified constructions
yield the same asymptotic bounds.
The first layout scheme draws Kn in an n × n × n-grid. The second scheme
then makes two drawings of Kn/2 (without recursion) using the first scheme;
then it positions these drawings in an n2 × n × n2 -grid and supplies the edges
between the two parts.

3.1.1 Drawing Kn in an n × n × n-grid for k = 1


Enumerate the vertices as v1 , . . . , vn . Place vertex vi at (i, i). Route edge
e = (vi , vj ), where i < j, with one bend via (i, i), (i, j), (j, j). Note that no
vertex or part of an edge is placed at a point (x, y) with y < x.
Now partition the edges of Kn into n edge sets Eia , Eib , i = 1, . . . , n2 , defined
as Eia = {(vi−l+1 , vi+l )|l = 1, . . . , n2 } and Eib ={(vi−l , vi+l )|l = 1, . . . , n2 − 1} (all
additions are modulo n). It is easy to check that these sets indeed partition the
edges of Kn , and that neither crossings nor overlaps occur either among edges
in Eia or among edges in Eib . Hence only n z-planes are needed. See Fig. 3.

E1a E2a E3a E4a

E1b E2b E3b E4b

Figure 3: The sets E1a , . . . , E4a and E1b , . . . , E4b for K8 .

This gives the following lemma.

Lemma 2 If n is even, there exists a drawing of Kn in an n × n × n-grid with


one bend per edge such that the points {(x, y, z)|y < x} are unused.
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 72

Proof: Represent each vertex vj , i ≤ j ≤ n, as a line segment (hence a grid box)


with endpoints (j, j, 1) and (j, j, n). Route the edges in Eia , 1 ≤ i ≤ n/2, in the
(z = i)-plane as described above. Similarly, route the edges in Eib , 1 ≤ i ≤ n/2,
in the (z = n/2 + i)-plane. This gives a crossing-free drawing with the desired
properties. 2
Remark: Note that Eia and Eib can be drawn in the same plane by reflecting
the edges of Eia with respect to the diagonal line through the vertices. This
yields a drawing of Kn in an n × n × n2 -grid. This strategy is closely related to
the pagenumber of a graph (see for example [6]), and in fact, may prove a useful
idea for drawing sparse graphs.

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.

Theorem 3 For a given n, let N ≥ n be the smallest number that is divisible


by 4. Kn can be drawn in an N2 × N × N2 -grid with at most one bend per edge
and total number of bends at most N 2 /4 − N/2.

Proof: Draw KN as described above, ignoring the N − n vertices not belonging


to Kn , and their incident edges. The volume bounds follow directly from the
construction. There are N 2 /4 edges drawn without a bend, and all other edges
have one bend, so the total number of bends is at most N 2 /4 − N/2. 2
Remark: Since N ≤ n + 3, our construction has a volume of 14 n3 + O(n2 ).

3.2 A smaller O(n3 ) volume drawing for k = 2


A similar strategy can be applied when a maximum of k = 2 bends on an edge is
allowed. For simplicity, we assume in the description of our constructions that
n is divisible by 4. When this is not the case, slightly modified constructions
yield the same asymptotic bounds.
We draw Kn with at most two bends per edge by first making two copies
of a drawing for K n2 (without recursion) and then placing them in a grid of
side-length n2 and supplying the edges connecting the two parts.

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.

E1a E2a E3a E4a

E1b E2b E3b E4b

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

Lemma 3 If n is even, there exists a drawing of Kn in an n × n2 × n-grid, with


a total of n2 − 3n + 2 bends and at most two bends per edge, such that the line
segment (grid box) for vertex vi contains the points {(i, 1, z)|1 ≤ z ≤ n}.

Proof: Represent each vertex vj , i ≤ j ≤ n, as a line segment (hence a grid


box) with endpoints (j, 1, 1) and (j, 1, n). Route the edges in Eia , 1 ≤ i ≤
n/2, in the (z = i)-plane as described above. Similarly, route the edges in Eib ,
1 ≤ i ≤ n/2, in the (z = n/2 + i)-plane. This gives a crossing-free drawing
with the desired volume bounds. The edges (vi , vi+1 ) for i = 1, . . . , n − 1 are
drawn straight; all other edges have two bends, so the total number of bends is
2(n(n − 1)/2 − (n − 1)) = n2 − 3n + 2. 2

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

Figure 6: The combination of K 1 , and the rotated K 2 (we moved K 2 farther


away for clarity).

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 .

Theorem 4 For a given n, let N ≥ n be the smallest number that is divisible


by 4. Kn can be drawn in a N2 × N2 × N2 -grid with at most two bends per edge
and total number of bends at most N 2 /2 − 3N + 4.

Proof: Draw KN as described above, ignoring the N − n vertices not belonging


to Kn , and their incident edges. The volume bounds follow directly from the
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 75

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 ).

3.3 An O(n2.5 ) volume drawing for k = 3


In this section, we draw Kn with at most k = 3 bends on any edge and with
volume O(n2.5 ). Case 2 of the lower bound proof suggests what general form
such a drawing might take. For simplicity, we assume in the description of our
constructions that n = r 2 for some integer r. When this is not the case, slightly
modified constructions yield the same asymptotic bounds.
Enumerate the vertices as ordered pairs (i, j), where 1 ≤ i ≤ r, 1 ≤ j ≤ r,
and place vertex (i, j) at (2i, 2j) in the 2-D xy-plane. Suppose edge e joins
vertex (i1 , j1 ) and vertex (i2 , j2 ). After possible renaming, we may assume that
i1 ≤ i2 , and that if i1 = i2 , then j1 > j2 . Call e an L-edge if j1 > j2 and a
Γ-edge otherwise. Fig. 7 shows some L-edges.
Initially route each L-edge via the points (2i1 , 2j1 ), (2i1 +1, 2j1 ), (2i1 +1, 2j2 +
1), (2i2 , 2j2 + 1), (2i2 , 2j2 ), thus with three bends. Route each Γ-edge via points
(2i1 , 2j1 ), (2i1 + 1, 2j1 ), (2i1 + 1, 2j2 − 1), (2i2 , 2j2 − 1), (2i2 , 2j2 ).
Split the L-edges into r(r − 1) groups Edx ,dy , with 0 ≤ dx ≤ r − 1 and
1 ≤ dy ≤ r − 1. Each group Edx ,dy consists of those edges ((i1 , j1 ), (i2 , j2 )) for
which i2 = i1 + dx and j2 = j1 − dy . These groups cover all L-edges since i1 ≤ i2
and j1 > j2 for any L-edge.
Now split each group Edx ,dy into at most dx + dy sets of edges as follows.
For p = 0, . . . , dx + dy − 1, let Edpx ,dy be the edges in Edx ,dy for which j2 − i1 = p
modulo (dx+dy ). In other words, the lower left “corners” of the L-edges in Edpx ,dy
lie on diagonals that intersect the y-axis at the value 2p modulo (2dx + 2dy ).
See Fig. 7. It is easy to check that no two edges in Edpx ,dy overlap or intersect
(except at endpoints), since the corners of the L’s are placed on a sequence of
diagonals; these diagonals have a vertical spacing of 2dx + 2dy between adjacent
diagonals. Also, note that Edpx ,dy is non-empty only if p ≤ 2r − dx − dy .1
Assign a z-plane to each set Edpx ,dy to obtain a legal drawing of the L-edges.
Route the Γ-edges in an analogous fashion. This doubles the √ number of z-planes,
yielding a drawing of Kn in a grid with X = Y = 2r = 2 n. The Z dimension
is given by
X X
r−1 r−1
2 min{dx + dy , 2r − dx − dy },
dx =0 dy =1

which is shown in the following technical lemma to be no greater than 43 r 3 .


Pr−1 Pr−1
Lemma 4 dx =0 dy =1 min{dx + dy , 2r − dx − dy } < 23 r 3 .
1 A java applet demonstrating the sets and their routings for K
100 can be found at
http://www.cs.uleth.ca/∼wismath/ortho.html. VRML constructions of any graph can be
created with the OrthoPak software package available from the above Web site.
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 76

y y

2dy

2dx + 2dy

(0,0) 2dx x (0,0) x

0 2
Figure 7: The edge sets E1,2 and E1,2 .

Proof: We write the values of min{dx + dy , 2r − dx − dy } in the specified range


as the following r × (r − 1)-rectangle:
dy min{dx + dy , 2r − dx − dy }
r-1 r-1 r r-1 r-2 3 2
r-2 r-2 r-1 r r-1 r-2 3
r-2 r-1 r r-1 r-2
r-2 r-1 r r-1 r-2
4 r-2 r-1 r r-1 r-2
3 3 r-2 r-1 r r-1 r-2
2 2 3 r-2 r-1 r r-1
1 1 2 3 r-2 r-1 r
0 1 2 r-3 r-2 r-1 dx
P 2
The sum of the r − 1 lower diagonals is r−1 k . The sum of the r − 1 upper
Pr−1 k=1
diagonals is k=1 k(k + 1). Hence the total sum is
X
r−1 X
r−1 X
r−1 X
r−1
(r − 1)r(2r − 1) r(r − 1)
k2 + k(k + 1) = 2 k2 + k= +
3 2
k=1 k=1 k=1 k=1
(r − 1)r(4r − 2 + 3) 4r 3 − 3r 2 − r 2
= = < r3 .
6 6 3
2

Theorem 5 For a given n, let r = d n e and let√N = r 2 . Then Kn can be
drawn in a 2r × 2r × 43 r 3 -grid with 32 N 2 − 15
2
N + 6 N bends and at most three
bends per edge.
Proof: Draw KN as described above, ignoring the N − n vertices not belonging
to Kn , and their incident edges. The volume bounds follow directly from the
construction. √
Every edge has three bends, except the 2r(r − 1) = 2N − 2 N edges where
dx = 0 and dy = 1, or dx = 1 and dy = 0, which can be drawn without √
a bend. So the√total number of bends is 3(N 2 /2 − N/2) − 3(2N − 2 N ) =
3 2 15
2N − 2 N + 6 N. 2
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 77

√ √ √
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

• provided a method for drawing Kn with volume that is provably within a


constant factor (same constant for all n) of best possible in the case that
at most k bends per edge are allowed, where k ≥ 3;
• proved a lower bound of Ω(n2.5 ) and an upper bound of O(n3 ) on the
volume of drawings of Kn when k = 1 and k = 2;
• proved a lower bound of Ω(n2 ) on the number of bends, which is matched
by our constructions.

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

[5] F. Brandenburg, editor. Symposium on Graph Drawing GD’95, volume


1027 of Lecture Notes in Computer Science. Springer-Verlag, 1996.
[6] A. Dean and J. Hutchinson. Relations among embedding parameters for
graphs. In Graph theory, combinatorics, and applications, Vol. 1, Kala-
mazoo, MI, 1988, Wiley-Intersci. Publ., pages 287–296. Wiley, New York,
1991.
[7] G. Di Battista, editor. Symposium on Graph Drawing GD’97, volume 1353
of Lecture Notes in Computer Science. Springer-Verlag, 1998.
[8] P. Eades, C. Stirk, and S. Whitesides. The techniques of Komolgorov
and Bardzin for three-dimensional orthogonal graph drawings. Information
Processing Letters, 60:97-103, 1996.
[9] P. Eades, A. Symvonis, and S. Whitesides. Two algorithms for three di-
mensional orthogonal graph drawing. In North [17], pages 139–154.
[10] S. Fekete, M. Houle, and S. Whitesides. New results on a visibility repre-
sentation of graphs in 3D. In Brandenburg [5], pages 234–241.
[11] S. Fekete and H. Meijer. Rectangle and box visibility graphs in 3D. Inter-
national Journal for Computational Geometry and Applications, 1998. To
appear.
[12] U. Fößmeier and M. Kaufmann. Drawing high degree graphs with low bend
numbers. In Brandenburg [5], pages 254–266.
[13] R. Graham, B. Rothschild, and J. Spencer. Ramsey theory. Wiley, New
York, 1980.
[14] J. M. Ho, M. Sarrafzadeh, G. Vijayan, and C. K. Wong. Layer assignment
for multichip modules. IEEE Trans. CAD, 9(12):1272–1277, 1990.
[15] D. Kirkpatrick and S. Wismath. Determining bar-representability for or-
dered weighted graphs. Computation Geometry: Theory and Applications,
6(2):99–122, 1996.
[16] T. Lengauer. Combinatorial Algorithms for Integrated Circuit Layout.
Teubner/Wiley & Sons, Stuttgart/Chicester, 1990.
[17] S. North, editor. Symposium on Graph Drawing GD’96, volume 1190 of
Lecture Notes in Computer Science. Springer-Verlag, 1997.
[18] A. Papakostas and I. Tollis. High-degree orthogonal drawings with small
grid-size and few bends. In 5th Workshop on Algorithms and Data Struc-
tures, volume 1272 of Lecture Notes in Computer Science, pages 354–367.
Springer-Verlag, 1997.
[19] A. Papakostas and I. Tollis. Algorithms for area-efficient orthogonal draw-
ings. Computational Geometry: Theory and Applications, 9:83–110, 1998.
T. Biedl et al., Orthogonal 3-D Graph Drawing, JGAA, 3(4) 63-79 (1999) 79

[20] A. Papakostas and I. Tollis. Incremental orthogonal graph drawing in three


dimensions. In Di Battista [7], pages 52–63.
[21] H. Purchase. Which aesthetic has the greatest effect on human understand-
ing? In Di Battista [7], pages 248–261.
[22] A. Rosenberg. Three-dimensional VLSI: A case study. Journal of the
Association of Computing Machinery, 30(3):397–416, 1983.
[23] R. Tamassia. On embedding a graph in the grid with the minimum number
of bends. SIAM J. Computing, 16(3):421–444, 1987.
[24] R. Tamassia and I. Tollis. A unified approach to visibility representations
of planar graphs. Discrete and Computational Geometry, 1:321–341, 1986.
[25] S. Whitesides, editor. Symposium on Graph Drawing GD’98, volume 1547
of Lecture Notes in Computer Science. Springer-Verlag, 1998.
[26] S. Wismath. Characterizing bar line-of-sight graphs. In 1st ACM Sympo-
sium on Computational Geometry, pages 147–152, Baltimore, Maryland,
USA, 1985.
[27] D. Wood. An algorithm for three-dimensional orthogonal graph drawing. In
Proceedings of Graph Drawing GD’98, Lecture Notes in Computer Science,
1998. To appear.
Journal of Graph Algorithms and Applications
http://www.cs.brown.edu/publications/jgaa/
vol. 3, no. 4, pp. 81-115 (1999)

Algorithms for Incremental Orthogonal Graph


Drawing in Three Dimensions
Achilleas Papakostas
Network Management Division
NEC America
1525 W. Walnut Hill Ln.
Irving, TX 75038
papakos@asl.dl.nec.com

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.

Communicated by G. Di Battista and P. Mutzel.


Submitted: March 1998. Revised: November 1998 and April 1999.

Research supported in part by NIST, Advanced Technology Program grant number


70NANB5H1162, and by the Texas Advanced Research Program under Grant No.
009741-040.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 82

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

the free direction of the other.


The length of a 3-D drawing is the maximum distance between two planes
parallel to the yz-plane containing any part of the drawing. The width of a 3-D
drawing is the maximum distance between two planes parallel to the xz-plane
containing any part of the drawing. The height of a 3-D drawing is the maximum
distance between two planes parallel to the xy-plane containing any part of the
drawing. If a 3-D drawing has length l, width w and height h, its volume is
l × w × h. It is actually the volume of the smallest rectangular parallelepiped
that encloses the 3-D drawing.
Before we present our two algorithms, we repeat very briefly the following
interactive graph drawing terminology: The current drawing is the drawing
before the insertion of new vertex v; the number of vertices of the current
drawing that are going to be connected with v through new edges, is v’s local
degree. We call these vertices adjacent vertices of v. Finally, a plane is to the
top of the topmost plane of the current drawing, if it is parallel to the xy-plane
and located one unit above the point of the current drawing with the highest
z-coordinate. This notion extends similarly to the other directions.

3 Drawing Graphs with Maximum Degree Six


In this section we present our incremental algorithm for producing orthogonal
drawings of graphs of maximum degree 6 in the three dimensional space. The
incremental nature of our algorithm comes from the fact that a user is allowed
to insert vertices (along with edges to existing vertices) into the current drawing
in any order. The algorithm supports such vertex insertions at any moment t,
as long as each request observes the following rules:
• We start the drawing from scratch, that is the very first current drawing
is the empty graph.
• The degree of any vertex of the current drawing at any time t is at most
6.
• The graph represented by the current drawing is always connected.
In the following two subsections, we describe how a new vertex is placed in
the current drawing and how its (at most six) incident edges are routed. Ver-
tices are represented by points. Our technique follows the Relative-Coordinates
scenario. This means that the decision about where a new vertex will be placed
and how its incident edges will be routed depends entirely on the free direc-
tions around the adjacent vertices. The properties of the Relative-Coordinates
scenario [25, 26, 28] are also properties of the 3-D drawings produced by our
algorithm and guarantee a ‘smooth’ transition from the current drawing to the
next. The notation u → p → p0 means that from vertex u we draw a straight
line segment that intersects plane p perpendicularly, and from the intersection
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 86

point we draw another segment to plane p0 that intersects p0 perpendicularly


as well. We use the notation pa,v , where a = x, y, or z and v is some vertex,
to denote the plane which is perpendicular to the a-axis and contains vertex v.
As we will see later, our 3-D orthogonal drawing is built in an upward fashion
(i.e., it grows along the positive z-axis). For this reason, we always keep the
following basic rule during the interactive drawing process:
Basic Rule: No vertex has a bottom free direction in any current drawing.
Most of the edges we route in 3-D follow one of five fundamental routes that
we now explain. Assume that w and w 0 are two vertices of the current drawing.
In the first three fundamental routes, edge (w 0 , w) always enters w 0 from its left
free direction.

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

• Second Fundamental Route: Vertex w has lower x-coordinate than


w 0 , and edge (w 0 , w) enters w from its right free direction. We open
up a new plane p parallel to the yz-plane and one unit to the right of
w. Edge (w 0 , w) is routed with three bends (see Fig. 2b), as follows:
w 0 → p → py,w → pz,w → w.
• Third Fundamental Route: Vertex w has lower x-coordinate and
higher y-coordinate than w 0 , and edge (w 0 , w) enters w from its front
free direction. No new plane is opened up and we route edge (w 0 , w) with
two bends (see Fig. 2c) as follows: w 0 → px,w → pz,w → w.

Although we used specific free directions for both w and w 0 in order to


describe the first three fundamental routes, we must stress that these routes
generalize to other situations as well. More specifically, if we derive the sym-
metric of the route shown in Fig. 2a with respect to the xy-plane or yz-plane,
we have new legal routes which still fall within the First Fundamental Route
category. Also, rotating the configuration of Fig. 2a or a symmetric of it by a
multiple of a right angle around the z-axis produces additional legal routes of the
First Fundamental Route type. In the same way, we can use symmetry and/or
rotation in the way described before to produce additional legal configurations
for the Second and Third Fundamental Routes.
In the remaining two fundamental routes, edge (w 0 , w) enters w 0 from its top
free direction. We also assume that w has higher z-coordinate than w 0 .

• 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.

3.1 Overview of the Algorithm - Preprocessing


Assume that we start with an empty graph. The following gives an overview of
the algorithm for placing the next vertex v in the current drawing. The steps
of this algorithm are analyzed in this and the following subsections. Let v1 be
the first vertex to be inserted. Vertex v1 has local degree 0. If v2 is the second
vertex to be inserted, then v2 has local degree 1 and is connected with v1 . In
Fig. 3a, we show the first two vertices inserted in an empty drawing. There are
three observations to make about Fig. 3a. First, edge (v1 , v2 ) has three bends.
Second, a total of seven new planes are inserted in the empty drawing. Third,
neither v1 nor v2 has a bottom free direction.

1. IF v is the first or second vertex to be inserted, THEN place them as


discussed above.
2. ELSE
(a) Find v’s adjacent vertices u1 , · · · ul in the current drawing.
(b) Determine connectors (one for each adjacent vertex) by using the
procedure described below.
(c) Find which Routing Case v’s insertion falls into.
(d) WITHIN a Routing Case:
i. IF Routing Case 1, THEN determine anchor vertex ua .
ii. IF Routing Case 2 or 3, THEN
A. IF degree of v is 6, THEN determine cover vertex uc .
B. Determine anchor vertex ua .
iii. Place v.
iv. Route edge (ua , v).
v. Route remaining edges (ui , v) except (uc, v), using the three Fun-
damental Routes and/or the Same-Plane Route.
vi. IF Routing Case 1, THEN determine cover vertex uc.
vii. Route edge (uc, v).
3. END.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 89

Let v be the next vertex to be inserted in the current drawing and l (1 ≤


l ≤ 6) be v’s local degree. We find the l adjacent vertices u1 , u2 , · · · ul of v.
According to the Basic Rule, v must not have a bottom free direction after v
is placed and all its l incident edges are routed. This means that exactly one
of these edges must enter v from the bottom. The vertex which is the other
endpoint of this edge is called anchor vertex, and is denoted by ua . If l = 6,
then the last one of v’s incident edges to be routed enters v from its top free
direction. The other endpoint of this edge is called cover vertex, and is denoted
by uc .

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

(a) FOR each ui :


i. ci := fdi .
(b) RETURN.
3. IF there are two opposite beams B1 and B2 , THEN
(a) Consider the beam with the smallest cardinality; say B1 .
(b) FOR each origin ui of B1 :
i. IF ui ’s top free direction is available, THEN ci := top connector.
ii. ELSE ci := fdi .
(c) FOR each ui that is NOT an origin of B1 :
i. ci := fdi .
(d) RETURN.
4. END.

3.2 Vertex Placement and Edge Routing


As we will see in this subsection, many of v’s incident edges are routed using
the fundamental routes. When this is the case, vertex v corresponds to w,
and the adjacent vertex ui which is the other end of the route corresponds to
w 0 . Depending on the types of connectors that v’s adjacent vertices have, we
distinguish three Routing Cases:
Routing Case 1: There is no beam among connectors ci . We distinguish
the following subcases for selecting the anchor vertex ua:
1. First Subcase: There is at least one adjacent vertex with top connector.
We consider the following cases:
• There is exactly one adjacent vertex with plane connector. If this is
left (front) or right (back) connector, then anchor ua is the adjacent
vertex with top connector whose y(x)-coordinate is the median of the
y(x)-coordinates of all adjacent vertices with top connectors.
• If there are exactly two adjacent vertices with plane connectors, we
have two situations:
– One plane connector is left (front) and the other one is right
(back). Anchor ua is the vertex with top connector whose y(x)-
coordinate is the median of the y(x)-coordinates of all adjacent
vertices with top connectors.
– The two plane connectors are orthogonal. If one of them is a left
(right) plane connector, then anchor ua is the vertex with top
connector having the lowest (highest) x-coordinate of all adjacent
vertices with top connectors.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 91

• If there are exactly three adjacent vertices with plane connectors,


we find the plane connector which is orthogonal to the other two.
If this is a left (resp. back, right, front) connector, then anchor
ua is the adjacent vertex with top connector having the lowest x-
coordinate (resp. highest y-coordinate, highest x-coordinate, lowest
y-coordinate) of all adjacent vertices with top connectors.
• In any other situation, any adjacent vertex with top connector can
be the anchor ua.
We insert a new plane p to the top of the topmost plane of the current
drawing. Vertex v is placed at the intersection of planes p, px,ua , py,ua ,
directly above ua . Edge (ua , v) is a simple straight line segment from ua
to v (see Fig. 3b).
2. Second Subcase: There is no adjacent vertex having top connector. In
this situation, any adjacent vertex can be the anchor vertex ua . Assume
that ua has left connector. We insert three new planes p1 , p2 , p3 so that p1
(p2 ) (p3 ) is to the left (back) (top) of the leftmost (backmost) (topmost)
plane of the current drawing. Vertex v is inserted at the intersection of
planes p1 , p2 , p3 . Edge (ua , v) is routed with two bends (see Fig. 3c) as
follows: ua → p1 → p2 → v. This generalizes to cases where ua has a
different plane connector, through a rotation.
Any edge (ui , v) where ui is not the anchor is routed in one of the following
ways: If ui has plane connector, edge (ui , v) is routed with three bends using the
First Fundamental Route (see Fig. 3b for a complete example). If ui has top
connector, edge (ui , v) is routed with two or three bends using the Same-Plane
Route. Finally, note that if l = 6, cover vertex uc has top connector and is
routed with three bends using the Over-The-Top Route.
Routing Case 2: There is at least one beam among connectors ci and
there are no two opposite beams. If there is at least one adjacent vertex with
top connector and l = 6, then any such vertex can be the cover uc . If l = 6 and
there is no adjacent vertex with top connector, then cover uc is the adjacent
vertex with highest z-coordinate which belongs to a beam. Then, we find the
beam Bmax having the highest cardinality without counting uc . Assume that
Bmax is a left beam (the following discussion generalizes through rotation).
Anchor ua is always one of Bmax ’s origins. More specifically, it is the vertex
whose y-coordinate is the median of the y-coordinates of all Bmax ’s origins.
We insert three new planes p1 , p2 , p3 parallel to the three base planes, so
that p1 is to the left of the leftmost plane of the current drawing. If there is
at least one adjacent vertex with top connector or if l < 6, then plane p3 is to
the top of the topmost plane of the current drawing. Otherwise, (i.e., l = 6
and there is no adjacent vertex with top connector), we insert p3 one unit to
the bottom of uc (note that p3 is parallel to the xy-plane). We distinguish the
following subcases for plane p2 which is parallel to the xz-plane:
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 92

1. First Subcase: There are no two orthogonal connectors. If Bmax has


cardinality 2, then plane p2 is placed one unit to the front of adjacent
vertex ui which has top connector, is not the cover (if there is one), and has
the highest y-coordinate among all adjacent vertices with top connectors.
If Bmax has cardinality higher than 2 or if such a vertex ui does not exist,
then plane p2 is placed one unit to the back of ua . Vertex v is placed at
the intersection of planes p1 , p2 , p3 . Edge (ua , v) is routed with two bends
(see Fig. 3c) as follows: ua → p1 → p2 → v.
2. Second subcase: There is one pair of orthogonal beams, or there is only one
beam and it is orthogonal to at least one connector. This means that Bmax
is orthogonal either to another beam (which we assume is a back beam) or
to some connector ci (which we assume is a back connector). Plane p2 is
placed to the back of the backmost plane of the current drawing. Placing
v and routing edge (ua , v) is done as in the First Subcase.
We use the First, Second, and Third Fundamental Routes to route the re-
maining edges (ui , v) where ui has a plane connector. These edges eventually
attach only to plane free direction of v. Note that the Third Fundamental Route
can be used only by vertices which are origins of Bmax . Edges that come from
adjacent vertices having top connectors are routed using the Same-Plane Route.
If l = 6 and cover uc has top connector, then edge (uc , v) is routed using the
Over-The-Top Route.
If cover uc does not have top connector, then, by the way it was chosen,
it has the following properties: (a) uc has higher z-coordinate than v, and (b)
uc has either left (if it is an origin of Bmax ), or back (if it is an origin of the
other beam different from Bmax ) connector. If it has left (back) connector, it is
routed with two bends as follows: uc → p1 (p2 ) → p2 (p1 ) → v. Figure 3d shows
an example of this route when uc has left connector.
Routing Case 3: There are two opposite beams among connectors ci ’s.
Clearly, in this routing case, we have that l ≥ 4. Bmax is the beam with the
highest cardinality. Let us assume that Bmax is a left beam (the discussion
generalizes through rotation). Let B be the beam which is opposite to Bmax .
We first discuss the situation where (a) l ≤ 5, or (b) l = 6 and there is at least
one adjacent vertex with top connector (this vertex is cover uc and edge (uc, v)
is routed using the Over-The-Top Route).
Anchor ua is the median of the origins of beam Bmax with respect to their
y-coordinates. We open up three new planes p1 , p2 , p3 as follows: p1 is to the
left of the leftmost plane of the current drawing, and p3 is to the top of the
topmost plane of the current drawing. Plane p2 is parallel to the xz-plane and
between the two origins of beam B. Vertex v is inserted at the intersection of
planes p1 , p2 , p3 . We route edge (ua , v) with two bends (see Fig. 3c) as follows:
ua → p1 → p2 → v.
If Bmax has two origins, then there can be at most one adjacent vertex u0
with front, back, or top connector (u0 is not the cover vertex). If u0 has front or
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 93

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.

3.3 Routing Properties - Analysis


Placing a new vertex v and routing its incident edges has several cases which
were described in detail in the previous subsection. We believe that this de-
scription of all the involved cases was necessary especially if this algorithm is
to be implemented. We saw that vertex v is usually placed at the intersection
point of three planes, at least two of which are new.
Placing a vertex v directly to the top of vertex u (when routing edge (u, v))
happens only when u had current degree 5 before this edge insertion. This way,
edges that enter u and v from their same plane free direction cannot cross. In
any other case that two vertices have the same either x or y-coordinate, the
one with the lower z-coordinate does not have an available top free direction
(see Routing Case 3). Note that, although it is possible for two vertices to have
the same x and/or y-coordinate, there are never two vertices with the same
z-coordinate.
An important feature of our edge routing technique is that no two edges
cross. The route of each edge is naturally decomposed in three different stages.
Let us consider an edge e from u to v, where v is the vertex most recently placed
in the drawing. The first stage contains the portion of the route that lies entirely
in plane pz,u . This portion consists of a straight line segment that goes all the
way until it hits a new plane positioned outside the current drawing. This line
segment does not cross any other edges in its way, because no available free
direction is ever blocked.
When it hits the new plane, the line segment of the first stage may bend
staying always in plane pz,u . This new segment does not cross any other edge
either, since it runs entirely outside the current drawing. In the second stage,
we have the portion of the route consisting of a straight line segment running
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 95

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:

Theorem 1 There is a 3-D orthogonal graph drawing algorithm for graphs of


maximum degree 6 that allows on-line vertex insertion so that the following hold
at any time t:
• after each vertex insertion, the coordinates of any vertex or bend of the
current drawing shift by a small constant amount of units along the x, y, z-
axes, effectively maintaining the general shape of the drawing,
• there are at most three bends along any edge,
• no two edges cross,
• the volume of the drawing is at most 4.63n3(t), where n(t) is the number
of vertices in the drawing at time t, and
• vertex insertion takes constant time (if the screen needs to be refreshed
after each vertex insertion, then it takes linear time).

Our incremental algorithm can be used to produce a 3-D orthogonal drawing


of a graph by first numbering its vertices and then inserting each vertex one at
a time, according to its number. A numbering with the following property will
guarantee that each placed vertex has local degree at least 1: If j (j > 1)
is the number assigned to vertex vj , then there is at least one edge (vi , vj )
in the graph, where i < j. Consider the directed acyclic graph that results
from the given graph when each edge is directed from the lower to the higher
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 97

6
4

Figure 5: 3-D orthogonal drawing of K7 produced by our algorithm.

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:

Theorem 2 Consider an n-vertex connected graph G of maximum degree 6.


There is a linear time algorithm that produces a 3-D orthogonal drawing of G,
so that each edge has at most three bends, no two edges cross, and the volume
of the drawing is at most 4.63n3.

In Fig. 5 we show the 3-D orthogonal drawing of K7 produced by our


algorithm. The numbers in the vertices denote the order in which the vertices
were inserted. The volume of this drawing is 8 × 8 × 8 = 512 ≤ 1.5n3 , where
n = 7. Observe that out of K7 ’s 21 edges, there is one edge with no bends, 12
edges require two bends each, and the remaining eight edges are routed with
three bends each. The algorithm has been implemented within 3DCube [29]
and we present preliminary experimental results in the Conclusions.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 98

4 A Model for Vertices of High Degree


In this section we describe a model to support high degree interactive three
dimensional orthogonal graph drawing based on the Relative-Coordinates sce-
nario. Our model allows vertices to arrive on-line and the degree of the vertices
to increase arbitrarily. At any time there is a change in the drawing, our target
is to maintain the general shape of the current drawing. Our model and the
drawing algorithm which is based on it, apply also to non-interactive settings.
In these settings, the whole graph is known in advance and the user provides
the order in which the vertices are considered for placement.
The first issue that has to be addressed is the way that vertices are repre-
sented. In the previous section, it sufficed to map vertices to points in space
since the degree of any vertex was at most 6 at any time during the drawing
process. Clearly, we now need a different approach to accommodate arbitrary
vertex degrees. We choose to represent vertices using 3-D boxes of volume
(initially) at least one cubic unit, regardless of the degree of the vertices.
When a vertex is inserted into the drawing, it is represented by a cubic box
with size depending on the degree of the vertex. Edges that are adjacent to a
vertex are attached to the surface of its box. The points on the box surface where
edges can be attached are called connectors, and they have integer coordinates.
Each box has six sides, and each side is a rectangle parallel to one of the base
planes. If d × d0 is the size of one side of a box, then both d and d0 are integers
and there are (d + 1)(d0 + 1) connectors on this side.
Let us consider a vertex v and the box that represents it. The two sides of
the box that are parallel to the xy-plane are called top and bottom sides, with
top being the side located at a higher z-coordinate between the two. The two
sides parallel to the yz-plane are called left and right sides, with right being the
side located at a higher x-coordinate between the two. Similarly, the remaining
two sides are the front and back sides, with back being the side located at a
higher y-coordinate between the two. The six sides of box v are shown in Fig.
6a, and the connectors of the front side are shown in Fig. 6b, where v is a
4 × 4 × 4 cube.
Note that all connectors located along the line where two sides meet are
shared by both sides. Also, the single connector located at the point where
three sides meet is shared by all three sides. The distance between the left and
right sides is called length of the box. Similarly, the distance between the front
and back sides is called width, and the distance between the top and bottom
sides is called height of the box. In a d1 × d2 × d3 box the length is d1 , the width
is d2 and the height is d3 .
Edge routing follows the Relative-Coordinates scenario, and tries to keep
both volume and number of bends as low as possible. However, as a result of
this routing, edges may require to attach to specific sides of incident boxes. If
there are no available connectors on that side, we need to grow the box creating
new connectors on that side. Our model for representing vertices in 3-D space
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999) 99

(a) (b)

Figure 6: (a) Every box has six rectangular sides, (b) front side connectors of a
box.

supports box growing.


Let us assume that we have a d1 × d2 × d3 box representing vertex v. There
are two ways to grow a box by increasing its length: one way is to increase the
length towards the right direction (see Fig. 7a), and the other is to increase the
length towards the left direction (see Fig. 7b). In either case, the result is a
(d1 + 1) × d2 × d3 box v. Also notice that the resulting box has:
• d2 − 1 new connectors on its top side,
• d2 − 1 new connectors on its bottom side,
• d3 − 1 new connectors on its front side,

• d3 − 1 new connectors on its back side,


• one new connector shared by the top (bottom) and back (front) sides,
• one new connector shared by the top (bottom) and front (back) sides.
Similarly, we can grow box v by increasing its width by one unit (towards
the front or the back direction), or its height by one unit (towards the top or the
bottom direction). Regardless of the way we choose to grow a box, we always
insert a new plane in the middle of the current 3-D drawing. This insertion
affects the coordinates of some connectors and bends which shift by one unit
along the x, y or z-axes. The general shape of the drawing, though, remains the
same. Finally, note that although the box of every vertex starts out having a
cubic configuration (when it is inserted for the first time), this is not necessarily
the case later. This happens because a box may grow its size in several different
ways in the course of the drawing process.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)100

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.

5 Drawing Graphs of High Degree


In this section we present a drawing algorithm based on the Relative-Coordinates
scenario for producing orthogonal drawings of graphs in the three dimensional
space. Since this algorithm allows vertices to arrive on-line, the order of vertex
insertion is decided by the user. In order to simplify our presentation, we as-
sume that the local degree of any vertex that is about to be inserted cannot be
greater than 16. We will discuss how to easily generalize our technique at the
end of this section. We compute bounds on the volume and the total number of
bends that each (current) drawing requires at time t, when we start the drawing
from scratch.
A typical user request consists of the name of the vertex to be inserted, say v,
and a list of its adjacent vertices in the current drawing. Our algorithm produces
a 3-D drawing considering and placing one vertex at a time. The placement of
vertex v follows the Relative-Coordinates paradigm. In other words, it tries
to maintain the general shape of the current drawing after v is inserted. For
this reason, the selection of the position where v will be placed depends on the
following factors:

• Vertex v’s local degree.


• The connector availability situation on the sides of the boxes of v’s adja-
cent vertices.
• The relative position of v’s adjacent vertices in the current drawing.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)101

5.1 Placing a New Vertex


Again, assume that v is the next vertex to be inserted in the current 3-D drawing.
Let k (k ≤ 16) be v’s local degree, and let u1 , u2 , · · · uk be v’s adjacent vertices.
For each vertex ui we find the sides of box ui that have available connectors.
Recall that some connectors are shared by two or even three sides. Then we find
the side of the adjacent boxes on which most of these boxes have at least one
available connector. This is the side where the edges connecting v with each ui
will be attached.
For example, assume that k = 10, there are three adjacent boxes that have
available connectors on their back side, and for any other side (i.e., top, bottom,
right, left, front) there are no more than two adjacent boxes having available
connectors on that side. Then, for each one of the ten adjacent boxes, the edge
that connects this box with v will attach to a back side connector of that box. If
there is any adjacent box which does not have available connectors on its back
side, then we grow the box. This can be done by increasing either the length
or the height of the box by one unit, as described in the previous section. Such
an increase will create more than one connectors which lie not only on the back
side but on other sides as well. These connectors may be used at a later stage.
The next step is to create the box representing v and place it in the current
3-D drawing. Box v is a 1 × 1 × 1 cube. Each newly inserted box is placed in
such a way so that none of its connectors have the same x, y or z-coordinate as
any other connector of any box of the current drawing. This means that our
3-D drawing has the property that there are no two connectors of two different
boxes lying on a plane parallel to a base plane. We call this the no-common-
plane property of the 3-D drawing. Next we show how v’s exact position in the
drawing is calculated so that this property is maintained.
For the sake of description, let us consider the case where all k edges con-
necting v with its adjacent vertices attach to the back sides of these vertices.
Also, let c1 , c2 , · · · ck be the connectors of the adjacent boxes where these edges
will be attached. We insert a new plane p0 to the back of the backmost plane
of the current drawing (clearly, p0 is parallel to the xz-plane).
We compute the projections of connectors c1 , c2 , · · · ck on the xz-plane. Be-
cause of the no-common-plane property, there are no two projection points
sharing the same row or column in the xz-plane. We find the projection point
c0i whose x-coordinate is the median of the x-coordinates of all projection points;
if there are two medians, we take the one with the higher x-coordinate. Also,
we find the projection point c0j whose z-coordinate is the median of the z-
coordinates of all projection points; in case there are two medians, we take the
one with the higher z-coordinate. Note that it is possible for c0i and c0j to be the
same point. In Fig. 8a we show points c0i and c0j chosen from a set of 11 points
placed in the xz-plane.
If c0i is the projection of connector ci located on the back side of box ui ,
we insert a new plane pi in the 3-D drawing parallel to the left side of ui at a
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)102

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.

Proposition 5.2 If c1 , c2 , · · · ck are the connectors of the adjacent boxes of a


newly inserted vertex v where v’s incident edges will be attached, then all these
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)103

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.

5.2 Routing Edges with Two Bends


The step that concludes the insertion of v is routing the edges that connect v
with its adjacent vertices. For each edge ei we have that one endpoint of the
edge is connector ci of adjacent box ui , and the other endpoint is a connector of
some side of v. The portion of edge ei between its two endpoints is routed in an
orthogonal fashion in three dimensional space. In the description that follows,
we assume that v has been placed as described above, and we continue with the
routing of v’s incident edges.
Let us first route the edges that come from connectors having z-coordinate
greater than the z-coordinate of any point on v’s top side. Because of the
no-common-plane property, some of these connectors have x-coordinate smaller
than the x-coordinate of any point on v’s left side, and the remaining connectors
have x-coordinate greater than the x-coordinate of any point on v’s right side.
We call the connectors of the first group outleft, and the connectors of the second
group outright.
Assume that the outleft connectors are fewer than the outright ones; this
dke
means that the number of the outleft connectors is less than d 22 e. Since k can
be at most 16, we have that the outleft connectors are at most four, which is
the maximum number of connectors lying on a single side of box v. The edges
that start from outleft connectors are routed to connectors lying on the top side
of box v.
More specifically, let us route edge ei from outleft connector ci to connector
cv of v (see Fig. 9a). From connector ci , we draw a straight line parallel to
the y-axis that intersects plane py,cv at point bi forming a right angle. Then we
draw another straight line from bi along plane py,cv and parallel to the x-axis,
that intersects plane px,cv at point b0i forming a right angle. Then, we simply
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)104

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:

Lemma 2 Let v be the next vertex to be inserted in a 3-D drawing. Let e be


the edge connecting v with its already placed adjacent vertex u. Let connector
cu of u be one endpoint, and connector cv of v be the other endpoint of edge e.
Also, let fdcu and fdcv be cu ’s and cv ’s free directions, respectively, used by e.
The following hold:
1. If connector cu belongs to side su which is perpendicular to fdcu and con-
nector cv belongs to side sv which is perpendicular to fdcv , then the planes
containing sides su and sv are perpendicular to each other.
2. Edge e connecting cu and cv is routed orthogonally with exactly two bends.
3. If b1 is the bend adjacent to connector cu and b2 is the bend adjacent to
connector cv then:
• if  is the straight line perpendicular to side su at point cu and p is
the plane parallel to side su containing cv , then bend b1 lies at the
intersection of line  and plane p,
• if 0 is the straight line of plane p parallel to side sv containing bend
b1 and 00 is the straight line of plane p perpendicular to side sv con-
taining point cv , then bend b2 lies at the intersection of lines 0 and
00 ,
• line segment b1 b2 does not block the free direction of any other con-
nector of u and v.
4. The connectors of v used for routing all v’s incident edges lie on at most
four sides of v.

5.3 No-Crossing Routing


Our routing scheme guarantees that each edge of every newly inserted vertex v
can be routed so that there are no edge crossings in the resulting 3-D drawing.
In order to show this, we first give some definitions.
Each edge consists of three straight line segments since it has two bends (see
above lemma). We call these line segments legs. More specifically, a leg with a
connector as one of its two endpoints is called an end leg, and a leg whose both
endpoints are bend-points is called a middle leg. Let v be the next vertex to
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)106

be inserted and e be the edge between v and an adjacent vertex u (u is already


placed). We insert v and route e, according to the algorithm. We show that no
leg of edge e crosses a leg of any edge of the current drawing.
Recall that if two line segments cross each other, then the four endpoints
of the two segments lie in the same plane. Because of the no-common-plane
property (see Proposition 5.1), it is never the case that an end leg of e crosses
an end leg of any other edge of the current drawing. Otherwise we would have
two connectors of two different boxes lying in a plane which is parallel to one
of the base planes.

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.

5.4 Volume and Bend Analysis


From the discussion in previous subsections we have that if m(t) is the total
number of edges in the drawing at time t, then the drawing has 2m(t) bends. In
what follows we express both the bends and the volume of the drawing in terms
of the number of vertices n(t) and the average vertex degree da (t) at time t.
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)107

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 .

Lemma 4 Let r be a positive number; let d be a positive constant so that integer


variables x, y and z satisfy: x + y + z = d, where x, y, z ≥ 0. Then it holds that:
(r + x)(r + y)(r + z) ≤ (r + d3 )3 .

Proof. It is well known that if we have three positive numbers a, b, c and a


positive constant s, then it always holds that: abc ≤ ( s3 )3 as long as a+b+c = s.
If we set: a = r + x, b = r + y, c = r + z and s = 3r + d, we have the above
lemma. 2
The first vertex inserted to an empty drawing is a 1×1×1 cube, so the volume
of the drawing after this insertion is 13 = 1. Let the volume of the current
drawing right before the insertion of new vertex v be at most r 3 . Then the
3
volume of the resulting drawing after the insertion of v is at most (r + dloc
3 + 2)
(see Lemma 4). The number 2 in the expression giving the volume comes from
the size of the box of inserted vertex v. Routing v’s incident edges does not
affect the volume since all these edges are routed along existing planes. Also
note that the above expression for the volume holds even if inserted vertex v
has local degree 0.

Theorem 3 There is an algorithm to produce 3-D orthogonal drawings of graphs


(not necessarily connected) which allows vertices to arrive on-line. Each in-
serted vertex is adjacent to at most 16 other vertices at the time of insertion.
The drawings have the following properties at any time t:
• vertices are represented by boxes and the surface of each box is at most six
times the current degree of the vertex,
• each edge has two bends,
• no two edges cross,

• the volume is ( m(t)


3
+2n(t))3 , where m(t) and n(t) are the number of edges
and vertices in the drawing at time t, respectively, and
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)108

• vertex insertion takes constant time.

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

Figure 11: 3-D orthogonal drawing of K5 representing vertices with boxes.

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.

6 Conclusions and Open Problems


We presented two incremental algorithms for producing orthogonal graph draw-
ings in three dimensional space with no edge crossings.
The first algorithm deals with simple graphs of maximum degree 6. For any
n-vertex graph, the produced drawing has volume at most 4.63n3. No edge has
more than three bends. This improves the best known [13] volume requirement
of exactly 27n3 significantly, while maintaining the same upper bound for the
number of bends per edge. It is also important to underline that our algorithm
requires linear time to produce a 3-D orthogonal drawing of an n-vertex graph,
3
whereas the algorithm in [13] runs in O(n 2 ) time.
The algorithm has been implemented within 3DCube [29] along with the
algorithms of [12, 13, 21] and a new algorithm introduced in [29]. The discussion
here is based on the preliminary experimental results of the implementation of
our algorithm sent to us by Maurizio Patrignani [30]. He applied our algorithm
on 1920 random, simple, connected graphs of maximum degree 6, such that the
number of edges is always twice the number of nodes. More extensive results on
several 3D orthogonal algorithms will be presented in a forthcoming paper [30].
The graphs of the experimental results are presented in Figs. 12 and 13.
These preliminary results indicate that:
• the volume is on the average 1.5n3 + O(n2 ),
• for medium and large size graphs the average number of bends per edge
is about 2.25, and
• as expected, the average edge length grows linearly with respect to the
number of nodes.
The second algorithm introduces 3-D orthogonal drawing for simple graphs
of degree higher than 6. Vertices are represented by solid 3-D boxes whose
surface is proportional to the degree of the vertex. The number of bends per
edge is only two.
Improving our volume upper bounds is a natural open problem. Although
there have been better volume upper bounds [13] at the expense of allowing
more bends per edge (seven bends per edge are allowed in [13]), cubic upper
bounds are the best known so far when we allow at most three bends per edge.
It is clear that there is a trade-off between volume and number of bends per
edge, or between volume and edge crossings. Determining the trade-offs is a
Papakostas and Tollis, Incremental 3-D Drawing, JGAA, 3(4) 81-115 (1999)111

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

Figure 13: Graphs of the experimental findings: edge length.

very interesting problem. Finally, if one restricts his/her attention to drawings


of graphs that are known ahead of time, is there a numbering of the vertices that
guarantees better performance with respect to volume and/or other aesthetic
measures?

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

[28] A. Papakostas, J. Six, and I. G. Tollis, Experimental and Theoretical Results


in Interactive Graph Drawing, Proc. of GD ’96, Lecture Notes in Comp.
Sci. 1190, Springer-Verlag, 1996, pp. 371-386.
[29] M. Patrignani and F. Vargiu, 3DCube: A Tool for Three Dimensional
Graph Drawing, Proc. of GD ’97, Lecture Notes in Comp. Sci. 1353,
Springer-Verlag, 1997, pp. 284-290.
[30] M. Patrignani, Personal communication, March 1998.

[31] P. Reid, Dynamic interactive display of complex data structures, in Graphic


Tools for Software Engineers, Cambridge 1989.
[32] S. Reiss, An engine for the 3D visualization of program information, J.
Visual Languages and Computing, vol. 6, no. 3, 1995.
[33] M. Schäffter, Drawing Graphs on Rectangular Grids, Discr. Appl. Math. 63
(1995) pp. 75-89.
[34] J. Storer, On minimal node-cost planar embeddings, Networks 14 (1984),
pp. 181-212.
[35] R. Tamassia and I. G. Tollis, A unified approach to visibility representations
of planar graphs, Discr. and Comp. Geometry 1 (1986), pp. 321-341.
[36] R. Tamassia and I. G. Tollis, Planar Grid Embeddings in Linear Time,
IEEE Transactions on Circuits and Systems CAS-36 (1989), pp. 1230-1234.

[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.

You might also like