Tải bản đầy đủ

Balanced Aspect Ratio Trees and Their Use for Drawing Large Graphs

Journal of Graph Algorithms and Applications
http://www.cs.brown.edu/publications/jgaa/
vol. 4, no. 3, pp. 19–46 (2000)

Balanced Aspect Ratio Trees and Their Use
for Drawing Large Graphs
Christian A. Duncan
Max-Planck-Institut f¨
ur Informatik
Saarbr¨
ucken, Germany
http://www.mpi-sb.mpg.de/~ duncan
christian.duncan@mpi-sb.mpg.de

Michael T. Goodrich

Stephen G. Kobourov

Center for Geometric Computing
The Johns Hopkins University
Baltimore, MD 21218

http://www.cs.jhu.edu/labs/cgc/
goodrich@cs.jhu.edu kobourov@cs.jhu.edu
Abstract
We describe a new approach for cluster-based drawing of large graphs,
which obtains clusters by using binary space partition (BSP) trees. We
also introduce a novel BSP-type decomposition, called the balanced aspect
ratio (BAR) tree, which guarantees that the cells produced are convex and
have bounded aspect ratios. In addition, the tree depth is O(log n), and
its construction takes O(n log n) time, where n is the number of points.
We show that the BAR tree can be used to recursively divide a graph
embedded in the plane into subgraphs of roughly equal size, such that
the drawing of each subgraph has a balanced aspect ratio. As a result, we
obtain a representation of a graph as a collection of O(log n) layers, where
each succeeding layer represents the graph in an increasing level of detail.
The overall running time of the algorithm is O(n log n+m+D0 (G)), where
n and m are the number of vertices and edges of the graph G, and D0 (G)
is the time it takes to obtain an initial embedding of G in the plane. In
particular, if the graph is planar each layer is a graph drawn with straight
lines and without crossings on the n×n grid and the running time reduces
to O(n log n).
Communicated by G. Liotta and S. H. Whitesides: submitted November 1998; revised November 1999.

Research supported in part by ARO grant DAAH04–96–1–0013 and NSF grant CCR9732300.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

1

20

Introduction

In the past decade hundreds of graph drawing algorithms have been developed
(e.g., see [7, 8]), and research in methods for visually representing graphical
information is now a thriving area with several different emphases. One general
emphasis in graph drawing research is directed at algorithms that display an
entire graph, with each vertex and edge explicitly depicted. Such drawings have
the advantage of showing the global structure of the graph. A disadvantage,
however, is that they can be cluttered for drawings of large graphs, where details

are typically hard to discern. For example, such drawings are inappropriate for
display on a computer screen any time the number of vertices is more than the
number of pixels on the screen. For this reason, there is a growing emphasis
in graph drawing research on algorithms that do not draw an entire graph,
but instead partially draw a graph, either by showing high-level structures and
allowing users to “zoom in” on areas of interest, or by showing substructures of
the graph and allowing users to “scroll” from one area of the graph to another.
Such approaches are well suited for displaying large graphs, such as significant
portions of the world wide web graph, where every web page is a vertex and
every hyper-link is an edge.
A common technique used for scrolling viewpoints is the fish-eye view [16,
18, 27], which shows an area of interest quite large and detailed (such as nodes
representing a user’s web pages) and shows other areas successively smaller and
in less detail (such as nodes representing a user’s department and organization
web pages). Fish-eye views allow a user to understand the structure of a graph
near a specific set of nodes, but they often do not display global structures.
An alternate technique displays the global structure present in a graph by
clustering smaller subgraphs and drawing these subgraphs as single nodes or
filled-in regions. By grouping vertices together into clusters, we can recursively
divide a given graph into layers of increasing detail. These layers can then be
viewed in a top-down fashion or even in fish-eye view by following a single path
in a cluster-based recursion tree. If clusters of a graph are given as input along
with the graph itself, then several authors give various algorithms for displaying
these clusters in two or three dimensions [10, 11, 13, 14, 24, 31]. If, as will often
be the case, clusters of a graph are not given a priori, then various heuristics can
be applied for finding clusters using properties such as connectivity, cluster size,
geometric proximity, or statistical variation [1, 17, 23, 25]. Once a clustering
has been determined, we can generate the layers in a hierarchical drawing of
the graph, with the layer depth (i.e., number of layers) being determined by
the depth of the recursive clustering hierarchy. This approach allows the graph
to be represented by a sequence of drawings of increasing detail. As illustrated
by Eades and Feng [10], this hierarchical approach to drawing large graphs
can be very effective. Thus, our interest in this paper is to further the study
of methods for producing good graph clusterings that can be used for graph
drawing purposes.
We feel that a good clustering algorithm and its associated drawing method
should come as close as possible to achieving the following goals:


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

21

1. Balanced clustering: in each level of the hierarchy the size of the clusters
should be about the same.
2. Small cluster depth: there should be a small number of layers in the recursive decomposition.
3. Convex cluster drawings: the drawing of each cluster should fit in a simple
convex region, which we call the cluster region for that subgraph.
4. Balanced aspect ratio: cluster regions should not be too “skinny”.
5. Efficiency: computing the clustering and its associated drawing should
not take too long.
In this paper we study how well we can achieve these goals for large graph
drawings using clustering. Previous algorithms optimize one or more of the
above criteria at the expense of some of the rest. Our goal is to simultaneously
satisfy all of them. Our approach relies on creating the clusters using binary
space partition (BSP) trees, defined by recursively cutting regions with straight
lines.

1.1

BSP Tree Based Clustered Graph Drawing

The main idea behind the use of a BSP tree in IR2 to define clusters is very
simple. Given a graph G = (V, E), where n = |V | and m = |E|, we can use
any existing method to embed it in the plane, provided that method places
vertices at distinct points in the plane (e.g., see [7, 20, 32]). For example, if G
is planar we can use any existing method for embedding G in the plane such
that vertices are at grid points, and edges of the graph are straight lines that
do not cross [6, 12, 28, 30, 33]. Once the graph drawing is defined, we build
a binary space partition tree on the vertices of this drawing. Each node v in
this tree corresponds to a convex region R of the plane, and associated with v
is a line that separates R into two regions, each of which are associated with
a child of v. Thus, any such BSP tree defined on the points corresponding
to vertices of G naturally defines a hierarchical clustering of the nodes of G.
Such a clustering could then be used, for example, with an algorithm like that
of Eades and Feng [10], who present a technique for drawing a 3-dimensional
representation of a clustered graph.
The main problem with using BSP trees to define clusters for a graph drawing
algorithm is that previous methods for constructing BSP trees do not give rise
to clustered drawings that achieve the design goals listed above. For example,
the standard k-d tree and its variants (e.g., see [15, 26]), which use axis-parallel
lines to recursively divide the number of points in a region in half, maintain
every criteria but the balanced aspect ratio. Likewise, quad-trees and fair-split
trees (e.g., see [4, 26]), which always split by a line parallel to a coordinate axis
to recursively divide the area of a region more or less in half, maintain balanced
aspect ratio but can have a depth that is Θ(n).
In graph drawing, aesthetics are very important, and while “fat” regions
appear rounder, a series of skinny regions can be distracting. But depth is also


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

22

important, for a deep hierarchy of clusterings would be computationally expensive to traverse and would not provide very balanced clusters. The balanced
box-decomposition tree of Arya et al. [3, 2] has O(log n) depth and has regions
with good aspect ratio, but it sacrifices convexity by introducing holes into the
middle of regions, which makes this data structure less attractive for use in
clustering for graph drawing applications. Indeed, to our knowledge, there is
no previous BSP-type hierarchical decomposition tree that achieves all of the
above design goals.

1.2

The Balanced Aspect Ratio (BAR) Tree

In this paper we present a new type of binary space partition tree that is better suited for the application of defining clusters in a large graph. Our data
structure, which we call the balanced aspect ratio (BAR) tree, is a BSP-type
decomposition tree that has O(log n) depth and creates convex regions with
bounded aspect ratio (also called “fat” regions). In this paper we present the
BAR tree in IR2 . The generalized BAR tree in IRd is presented in [9]. The
construction of the BAR tree is very similar to that of a k-d tree, except for two
important differences:
1. In addition to axis-aligned cuts, the BAR tree allows for one more cut
direction: a 45◦ -angled cut.
2. Rather than insisting that the number of points in a region be cut in half
at every level, the BAR tree guarantees that the number of points is cut
roughly in half every two levels, which is something that does not seem
possible to do with either a k-d tree or a quadtree (or even a hybrid of the
two) while guaranteeing regions with bounded aspect ratios.
In short, the BAR tree is an O(log n)-depth BSP-type data structure that creates
fat, convex regions. Thus, the BAR tree is “balanced” in two ways: on the one
hand, clusters on the same level have roughly the same number of points, and,
on the other hand, each cluster region has a bounded aspect ratio.
We show that a BAR tree achieves this combined set of goals by proving
the existence of a cut, which we call a two-cut. A two-cut might not reduce
the point size by any amount but maintains balanced aspect ratio and ensures
the existence of a subsequent cut, which we call a one-cut, that both maintains
good aspect ratio and reduces the point size by at least two-thirds. In Section
3, we formally define one- and two-cuts and describe how to construct a BAR
tree.

1.3

Our Results for Cluster-Based Graph Drawing

In Section 4, we show how to use the BAR tree in a cluster-based graph drawing
algorithm. The Large Graph Drawing (LGD) algorithm runs in O(n log n + m +
D0 (G)) time, where n and m are the number of vertices and edges in the graph
G and D0 (G) is the time to embed G in the plane. If the graph is planar,


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

23

Figure 1: A clustered graph C = (G, T ). The underlying graph G is at the lowest level

on the right. The clustering of G on the right is obtained from the BSP cuts on the left.
Each cluster is represented by a single node. Edges between layers on the right are edges
of the tree T .

the algorithm introduces no edge crossings and the running time reduces to
O(n log n).
The algorithm creates a hierarchical cluster representation of a graph, with
balanced clusters at each layer and with cluster depth O(log n). Each cluster
region has a balanced aspect ratio, guaranteed by the BAR tree data structure.
In the actual display of the clustered graph we represent the clusters either by
their convex hulls, or by a larger region defined by the BSP tree, or simply by
a single node, see Figure 1.

2

Using a BSP Tree for Cluster Drawing

Let G = (V, E) be the graph that we want to draw, where |V | = n and |E| =
m. Note that graph G is given combinatorially, i.e., defined by the order of
the neighbors around each vertex. An embedding of G also assigns distinct
coordinates in IR2 for every vertex v ∈ V (G). The edges of the graph are drawn
as straight lines. For the rest of this paper, we assume that the vertices of G
have integer coordinates, that is, the graph is embedded on the integer grid.
The goal of our LGD algorithm is to produce a representation of the graph G
given a BSP tree T , see Figure 1. Similar to [10] we define the clustered graph
C = (G, T ) to be the graph G, and the BSP tree T , such that the vertices of G
coincide with the leaves of T . An internal node of T represents a cluster, which


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

24

Figure 2: A 2-dimensional representation of a clustered graph C = (G, T ). The underlying graph G and the clustering are the same as in Figure 1. a simple closed curve.

consists of all the vertices in its subtree. All the nodes of T at a given depth i
represent the clusters of that level.
A view at level i, Gi = (Vi , Ei ), consists of the nodes of depth i in T and
a set of representative edges, for 0 ≤ i ≤ depth(T ). An edge (u, v) belongs
to Ei if there is an edge between a and b in G, where a is in the subtree of u
and b is in the subtree of v. In addition, each node u ∈ T has an associated
region, corresponding to the partition given by T . In Figure 1 we show an
example of a 3-dimensional representation of a graph G and in Figure 2 we
show a 2-dimensional representation of the same graph.
We create the graphs Gi in a bottom-up fashion, starting with Gk and going
all the way up to G0 , where k = depth(T ). Define the combinatorial graph
H = (V (H), E(H)), where initially V (H) = {u ∈ T : depth(u) = k} and
E(H) = E(G). Notice that H is well defined since the leaves of T are exactly
the vertices of G.
At each new level i we perform a shrinking of H. Suppose u, v ∈ V (H), and
parent(u) = parent(v). We replace the pair by their parent and remove the
edge (u, v) if it exists. We also remove any multiple edges that this operation
may have created and maintain for each surviving edge a pointer to the original
edge in G. Thus a shrinking of the graph H consists of all such operations,
necessary to transform H into a representation of G at one higher level in the
tree T .
At each level Gi is a subgraph of G with certain edges removed. Since we
are producing a representation of G in 3-dimensions, every vertex must have
three coordinates. The first two coordinates correspond to the location of the
vertex on the integer grid. The third coordinate of a vertex v ∈ Vi is equal to
i, that is, all the vertices in Gi are embedded in the plane given by z = i. To
obtain Gi from Gi+1 , for i = 0, . . . , k − 1, we use the combinatorial graph H
from level i + 1. Initially Ei = Ei+1 . We then perform a shrinking of H and
while removing an edge from H we remove its associated edge from Ei .
Thus the algorithm on Figure 3 runs in O(n · depth(T ) + m) time. Using
any of the previous known types of BSP trees, we can maintain most but never
all of the desired properties. For example, if T is a k-d tree the cluster regions
do not have balanced aspect ratios. We next describe how to construct a BSP
tree which satisfies all of our goal criteria.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

25

create clustered graph(T, G)
H ←G
k ← depth(T )
for i = k downto 0
obtain Gi from H
shrink H
return C
Figure 3: Given graph G embedded in the plane and BSP tree T create clustered graph

C. Here H is a combinatorial graph initially the same as G. The operations of obtaining
Gi from H and shrinking of H are defined in Section 2.

3

The BAR tree

Let us now discuss in detail the definition of our particular BSP-type decomposition tree, the BAR tree, and its construction. We begin with some general
definitions.
Definition 1 The following terms relate to various potential cuts:
• A canonical cut direction is any of the following three vectors:
vx = (1, 0), vy = (0, 1), vz = (1, −1).
• A canonical cut is any line whose normal is a canonical cut direction. For
example, the line x − y = 3 has normal vz .
• A canonical region is any convex polygon such that each side is a segment
of a canonical cut.
Since there are three cut directions1 , a canonical region can have at most
six sides. For convenience, we define six labels representing the six sides of the
polygon. Notice that some of these sides may have zero length. For a canonical
region R, we let xl and xr represent the corresponding left and right sides of R
with normal vx . Similarly, we define y l , y r , z l , and z r , see Figure 4.
Definition 2 For a canonical region R, let diami (R) be the Lm metric distance
between the two sides of R with normal vi . For a side l in R, we define |l| to be
the length of the line segment l measured in the Lm metric.
For simplicity in our arguments and notation, we use the L∞ metric although
any of the standard Lm metrics is acceptable. In the L∞ metric the distance
between two lines normal to vz and the length of a line segment normal to vz are
1 Note the assymetry of not having the canonical direction v
w = (1, 1). The arguments
that rely on the three canonical directions above also hold if we add this fourth direction, or
any others.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)
1
1

2

26

4
zl

yr

xl

xr
yl

3

zr

5

Figure 4: A labelling of the various sides of a canonical region R.
defined differently than in the L2 metric. In particular, for a canonical region
R with sides z l and z r , the length |z l | (or |z r |) is the vertical distance between
the two endpoints. The distance between the lines associated with z l and z r is
one half the vertical distance between the two lines.
Definition 3 The aspect ratio of a canonical region R is
ar(R) = max(diami (R))/ min(diamj (R)), ∀i, j ∈ {x, y, z}.
Given an aspect ratio parameter α, a region R is α-balanced if ar(R) ≤ α.
This definition is valid only for canonical regions. Since all of the regions
that appear in this section are canonical regions, whenever we refer to any
region we mean a canonical region. When the term α is understood, we refer
to α-balanced regions as simply balanced regions and refer to non-α-balanced
regions as unbalanced regions. Throughout the paper, we also call balanced and
unbalanced regions, respectively, fat and skinny regions.
To understand the various notions of a canonical region, let us look at one
specific canonical region R in Figure 4. Here we see the various sides of R, xl ,
xr , y l , y r , z l , z r . In particular, although not actually a true side of R, we still
represent the side z r . It is tangent to R and has zero length. From the figure,
we see the various lengths of each side:
|xl | = 2, |y l | = 5, |z l | = 1,
|xr | = 3, |y r | = 4, |z r | = 0.

Since we are using the L∞ metric, the length of z l is 1 rather than 2 as
would be the case in the L2 metric. We can also compute diami (R) for each of
the three canonical directions as well as the aspect ratio of R.
• diamx (R) = 5,
• diamy (R) = 3,
• diamz (R) = (2 + 5)/2 = 3.5,
• ar(R) = max(diami (R))/ min(diamj (R)) = diamx (R)/diamy (R) = 2.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

3.1

27

Constructing the BAR tree

We now introduce the BAR tree data structure. Suppose we are given a point
set S in the plane, |S| = n, and an initially square region R containing S. We
construct a BAR tree T on S recursively dividing R into cells such that the
following properties are guaranteed:
• Every cell in the tree is convex.
• Every cell in the tree has balanced aspect ratio.
• Every leaf cell contains at most a constant number of points of S.
• The tree has O(n) nodes.
• The depth of the tree is O(log n).
The structure is straightforward and reminiscent of the original k-d tree.
Recall that in a k-d tree, every node u in the tree represents a cell region
u.region and an axis-parallel cut u.cut partitioning that region into two subregions, u.left and u.right. The leaves of the tree are cells with a constant
number of points. In general, each cut divides the region into two roughly equal
halves, and thus the tree has O(log n) depth and uses O(n) space. However, if
the vast majority of the points is concentrated close to any particular corner of
the region, no constant number of axis-parallel cuts can effectively reduce the
size of the point set and maintain good aspect ratio. This is a serious concern for
many applications and for ours in particular. As a result, an extensive amount
of research has been dedicated to improving and analyzing the performance of
k-d trees and its derivatives, often concentrating on trying to maintain some
form of balanced aspect ratio [5, 19, 29].
We now show how to construct a BAR tree T from a point set S using an
aspect ratio parameter α and a balance parameter β. We prove that any αbalanced region can be divided by a sequence of one or two cuts into at most
three subregions. We also guarantee that each subregion is α-balanced and the
number of points in each of the three subregions is less than β times the number
of points in the original region. We begin by defining the notions of a one-cut
and a two-cut.
Definition 4 Let R be an α-balanced canonical region containing n points. Let
β be a given balance parameter. A one-cut is any canonical cut dividing R into
two subregions R1 and R2 such that:
1. R1 and R2 are both α-balanced canonical regions.
2. R1 and R2 contain at most βn points.
If there exists a one-cut for R, we say R is one-cuttable.
Definition 5 Let R be an α-balanced canonical region containing n points. Let
β be a given balance parameter. A two-cut is any canonical cut dividing R into
two subregions R1 and R2 such that:


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

28

create BAR tree(R, α, β)
create node u
u.region ← R
if number of points in R ≤ c,
return u
if an (α, β)-balanced one-cut s, exists in R
u.cut ← s
(R1 , R2 ) ← s(R)
else let s be an (α, β)-balanced two-cut in R
u.cut ← s
(R1 , R2 ) ← s(R)
u.left ← create BAR tree(R1 , α, β)
u.right ← create BAR tree(R2 , α, β)
return u

Figure 5: Creating the BAR tree. The recursion stops when a cell has a constant number
of points, c ≥ 1.

1. R1 and R2 are both α-balanced canonical regions.
2. R2 contains at most βn points.
3. R1 is one-cuttable.
If there exists a two-cut for R, we say R is two-cuttable.
For an α-balanced region R which is two-cuttable, let s represent the twocut dividing R into two regions R1 and R2 , and let s represent the one-cut
dividing R1 . In other words, the sequence of two cuts, s and s , results in three
α-balanced regions each containing at most βn points. To make it clear that α
and β are parameters, we often refer to one-cuts (resp. two-cuts) of a region R
as (α, β)-balanced one-cuts (resp. two-cuts).
Figure 5 shows the pseudo-code for the construction of a BAR tree. Here we
use the notation (R1 , R2 ) ← s(R) as a shorthand for cutting the region R with
a cut s resulting in subregions R1 and R2 . We prove in the next section that
every α-balanced region is either one-cuttable or two-cuttable for sufficiently
large constant values of α and β. Since the algorithm only uses one-cuts and
two-cuts, the regions produced are all α-balanced regions. The algorithm stops
the recursion when a leaf cell has a constant number of points from S. Because
at least every other cut used is a one-cut, the depth of the tree is O(log1/β n)
and the size is O(n). Therefore, the algorithm correctly creates a tree which
satisfies the properties for a BAR tree.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

29

yr

zl

xl

xr

xr

P
zr

yl

Figure 6: The shaded region P represents the region between xl and a maximal cut of
xr for a region R.

3.2

Two-cut existence theorem

Since the correctness of the previous algorithm relies on the existence of a twocut for a region, we prove that every region R is either one-cuttable or twocuttable. Before we do this, we need to describe some basic terminology relating
to cutting a region R into two subregions.
Definition 6 Suppose we are given an α-balanced canonical region R and a
canonical direction vi . Let il and ir be the two (possibly zero length) sides of
l
R normal to vi . Let i be the line containing il and let P be the region between
l
l
ir and i (at first P is the same as R). Sweep i towards ir until either P is
empty or just before P becomes unbalanced. We call this final region Ri,r = P
l
maximized in the direction from il . Similarly, we call i the maximal cut of il .
Ri,l is similarly defined.
Definition 7 For a region R with n points and a canonical direction vi , let Ri,l
(resp. Ri,r ) represent the region maximized in the direction from ir (resp. il ),
If Ri,l ∩ Ri,r = ∅ define Ri to be the region Ri,l or Ri,r with the larger number
of points. Otherwise if Ri,l ∩ Ri,r = ∅, define Ri to be R.
Since the change in aspect ratio during the sweep is continuous, the region
Ri,r has aspect ratio equal to α. Figure 6 illustrates a maximal cut of xr for a
canonical region R using the parameter α = 2. The region Ri,r maximized in the
direction from xr has aspect ratio ar(Ri,r ) = 2. Figure 7 shows a few more examples of regions with their respective maximal cuts and associated subregions.
The following lemma follows from a straightforward geometric argument.
l

Lemma 1 Given regions R and Ri,r and lines il and i as defined above, if
Ri,r is not empty and we continue sweeping in the same direction, the region
l
between i and ir will be unbalanced until it becomes empty.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)
yr

Rx,r

Rz,l
Ry,r

yl

xl

30

zl
zr

xr

xr

xl

yr

zl
zr

Ry,l
Rx,l

yl

Rz,r

Figure 7: The labels on the sides of a general canonical region and the maximizing cuts
from the respective directions.

Corollary 1 For an α-balanced region R, if the region Ri,r is maximized in the
direction from il , then min{diamx (Ri,r ), diamy (Ri,r ), diamz (Ri,r )} = diami (Ri,r ).

Corollary 2 For an α-balanced region R and direction vi , if Ri,l ∩ Ri,r = ∅,
l
r
then any cut im with a normal vi and lying between i and i produces two
α-balanced subregions R1 and R2 .
Lemma 2 Suppose we are given a region R with n points, a balance parameter
β ≥ 1/2 and two parallel lines cl and cr . Without loss of generality, let us orient
these lines so that cl lies to the left of cr . Then one of the following must be
true:
• The number of points from R to the left of cl (i.e., away from cr ) is more
than βn;
• The number of points from R to the right of cr (i.e., away from cl ) is more
than βn;
• There exists a line c parallel and between cl and cr dividing R into two
subregions R1 and R2 such that the number of points in either subregion
is less than βn.
Proof: Assume the first two conditions do not hold. Thus, we only need to
prove that the last condition must hold. Let n1 be the number of points to the
left of cl and let n2 be the number of points to the left of cr . We know then
that n1 > βn ≥ n/2. Similarly, we know that (n − n2 ) > βn ≥ n/2. It follows


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

31

then that n2 < n/2. Sweep a line c from cl to cr letting n3 be the number of
points to the left of c . Since the sweep is continuous, n3 varies from n1 > n/2
to n2 < n/2. In particular, there is a point where n3 = n/2. This cut divides R
into two subregions each with less than n/2 points.

Corollary 3 For an α-balanced region R with n points, a direction vi , and
β ≥ 1/2, either R is one-cuttable or Ri contains more than βn points.
Proof: If the two subregions Ri,l and Ri,r intersect each other, then by definition Ri = R and thus contains n points. If R is one-cuttable, then the statement
r
l
is trivially true. Otherwise, we have two cuts i and i associated with Ri,l and
Ri,r respectively. From Lemma 2, either Ri,l or Ri,r contains more than βn
r
l
points or there exists a line c parallel and between i and i dividing R into two
subregions R1 and R2 such that the number of points in either subregion is less
than βn. However, this implies that R is one-cuttable.

The above corollary is quite useful in proving that certain regions are onecuttable. For instance, let R be an α-balanced region such that, for some
canonical direction vi , both Ri,l and Ri,r are empty. Since neither of these two
subregions can contain any points, R must be one-cuttable. In fact, this notion
can be extended to include multiple canonical directions.
Lemma 3 Let R be an α-balanced region R with n points and β ≥ 2/3. If
Rx ∩ Ry ∩ Rz = ∅, then R is one-cuttable.
Proof: This is a standard extension from set theory. For a set of points S, it is
impossible to have three subsets of S each contain more than 2/3 of S without
their intersection containing at least one point.

If we can prove that there exist regions such that no possible assignment
for the Ri ’s allows for a non-empty intersection, then the region R is always
one-cuttable. Do there exist regions which are guaranteed to be one-cuttable?
We describe two such regions which we will use to argue that every α-balanced
region is inevitably two-cuttable.
Definition 8 For a given aspect ratio parameter α we define two special canonical regions with aspect ratio α as follows:
• Canonical isosceles trapezoidal (CIT) regions are trapezoids which have
z l and z r as the two opposing parallel base sides, see Figure 8a.
• Canonical right-angle trapezoidal (CRT) regions are trapezoids which have
their two opposing parallel base sides normal to either vx or vy , see Figure 8b.
Lemma 4 For α > 4 and β ≥ 2/3, canonical isosceles trapezoidal (CIT) regions
are one-cuttable.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

32

dx

xr
Rx,r
zl

dy

dx
δ

zr
Ry,l

dy

zl

Rx.r

Rz,l

xr

yl
(a)

(b)

Figure 8: Examples of (a) CIT and (b) CRT regions.
Proof: Without loss of generality, we can analyze the region R in Figure 8a,
since the other possible CIT regions are symmetrical. Let di = diami (R) for
i ∈ {x, y, z}. Define δ = |z r | = dx − |xr |. Since the trapezoid’s two parallel sides
are z l and z r , we know that dx = dy and |xr | = |y l |. Recall that in the L∞
metric, dz = (|xl | + |y l |)/2 = |y l |/2. Similarly, we get dz = |xr |/2. Since the
region has aspect ratio α, we have ar(R) = α = dx /dz . It follows that
dx

=

αdz

=
=

α|xr |/2
α(dx − δ)/2

=

αδ/(α − 2)

(1)

Let us examine the possible intersections of Rx ∩ Ry ∩ Rz . Since Rx,l is empty,
we know that Rx = Rx,r . Since by definition, Rx,r is maximized from xl , we
know that diamx (Rx ) ≤ dy /α = dx /α. From Equation 1 and from α > 4,
it follows that diamx (Rx ) < δ/2. Similarly, we know that Ry = Ry,l and
diamy (Ry ) < δ/2. This implies that Rx ∩ Ry = ∅. From Lemma 3, R must be
one-cuttable.

Lemma 5 For α > 4 and β ≥ 1/2, canonical right-angle trapezoidal (CRT)
regions are one-cuttable.
Proof: Without loss of generality, we can again analyze the region R in Figure 8b, since the other possible CRT regions are symmetrical. Let di = diami (R)
for i ∈ {x, y, z}. We know that maxi∈{x,y,z} (di ) = dx and mini∈{x,y,z} (di ) = dy
from the definition of the region. Therefore, we know that ar(R) = α = dx /dy .
Observing that |y r | = dx − dy , we obtain:
dy

= dx − |y r |


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

33

Figure 9: A region R which is not one-cuttable if the points are densely concentrated in
the highlighted corner. Notice that no canonical cut can divide this region without creating
a region that is too skinny.

= αdy − |y r |
= |y r |/(α − 1)

(2)

Let us examine the possible intersections of Rx ∩ Ry ∩ Rz . Since Rx,l is empty,
we know that Rx = Rx,r . Since by definition, Rx,r is maximized from xl , we
know that diamx (Rx ) ≤ dy /α. From Equation 2 and from α > 4, it follows that
diamx (Rx ) < |y r |/12. Similarly, we can see that Rz = Rz,l and diamz (Rz ) <
|y r |/6. This implies that Rx ∩ Rz = ∅. From Lemma 3 it follows that R must
be one-cuttable.

It is easy to construct examples where a region R is not one-cuttable for a
given a point set, see Figure 9. However, the following theorem shows that by
making a two-cut followed by a one-cut we can in fact divide an α-balanced
region into at most three α-balanced subregions each containing less than a
constant fraction of the points in R.
Theorem 1 (Two-Cut Existence Theorem) Any α-balanced region R is
either one-cuttable or two-cuttable for α ≥ 6 and β ≥ 2/3.
Proof: We can assume that R is not one-cuttable, and thus only prove that it
must be two-cuttable. Again let di = diami (R) for i ∈ {x, y, z}. Without loss
of generality, assume dy ≥ dx . Consider the two parallel sides, z l and z r . We
call a cut, z i , i ∈ l, r, small if
|z i | ≤ min(dx , dy )

α−2
α−2
= dx
,
α
α

and large otherwise. We now break the analysis into three cases based on
the size of these two sides. Each case follows roughly the same argument. If
a region is not one-cuttable, the three subregions Rx , Ry , and Rz must all
intersect each other since β ≥ 2/3. If one of these regions is one-cuttable, in
particular either a CIT or CRT region, then R is two-cuttable. Therefore, we
prove in each case that if all three subregions are not CIT or CRT regions, they
cannot simultaneously intersect.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

34

yr
zl

yr
Ry,r

zl

Rz,l

Ry,r
xr

xr
zl

xl

zr

zr

Ry,l

Rz,r

xl

zr
yl
(1)

Rx,l

z

yl
(2a)

(2b)

Figure 10: Case 1: both z l , z r are small. Case 2a: both sides are large and |y l | ≤ |xl |,
which guarantees that Ry,l and Ry,r are both CRT regions. Case 2b: both sides are large
and |y l | > |xl |.

Case 1. (z l and z r are both small):
Let both z l and z r be small, see Figure 10.1. From Equation (1) and because
z l is small, we know that diamx (Rz,l ) = α|z l |/(α − 2) ≤ dx . The same holds for
the region diamx (Rz,r ). Thus these two CIT regions are disjoint. Since there
was no one-cut, particularly in the z-direction, one of the two regions has more
than βn points. By Lemma 4, both CIT regions are one-cuttable. Therefore, R
has a two-cut, namely the one creating the CIT region with maximum points,
Rz .
Case 2. (z l and z r are both large):
Let both z l and z r be large. Without loss of generality, let the larger of the two
cuts be z l . Notice that,
dx (α − 2)/α < |z r | ≤ |z l | ≤ dx .
Because |z l | ≥ |z r | and dx ≤ dy , we know that |y r | ≤ |xr |. Therefore, Ry,r is a
CRT region, and is one-cuttable.
If |y l | ≤ |xl |, then Ry,l is also a CRT region, see Figure 10.2a. From Lemma 5,
Ry is always one-cuttable. Therefore, R is two-cuttable, the two-cut being either
yl or y r .
Otherwise, we have the situation in Figure 10.2b:
|xl | < |y l |
= dx − |z r |
≤ dx − dx (α − 2)/α
= dx (1 − (α − 2)/α)
= 2dx /α.

(3)


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

35

We now have bounds on |xl |, |y l |, and |y r |. Let us now bound |xr |. Using
Equation 3, we see that
dy




dx + |xl |
dx + 2dx /α



dx (1 + 2/α).

|xr | =

=

dy − |z r |
dx (1 + 2/α) − dx (1 − 2/α)
4dx /α

(4)

Using arguments similar to those used in proving Equation 2, we know that
diamx (Rx,r ) ≤


|xr |/(α − 1)
4dx /α(α − 1), and

diamy (Ry,l ) ≤

|y l |/(α − 1)



2dx /α(α − 1).

Consider the intersection of y r and xl and the cut z which passes through
this point, see Figure 10.2b. If z lies inside R, we can bound the size of the
intersection of this cut with R by
|z | =

(diamx (Rx,r ) + diamy (Ry,l ))




6dx /α(α − 1)
dx /5

<

|z r |.

However, this implies that z does not intersect R. Consequently, Rx,r ∩Ry,l = ∅,
and either Rx = Rx,l or Ry = Ry,r . Since either of these subregions is onecuttable, R is two-cuttable.
Case 3. (only one of the two cuts is large):
Without loss of generality, let the larger of the two cuts be z l . In other words,
|z l | > dx (α − 2)/α. Here we need to consider two subcases.
α+1
, we cannot necessarily cut the region
• 3i. (long rectangle) If dy ≥ dx α−2
using the direction vx . Using the same argument as in Case 2, we see that
Ry,r is a CRT region. Thus, if Ry = Ry,r , we are done. Similarly, using
the argument for Case 1, we see that Rz,r is a CIT region, see Figure 11a.
Therefore, we can assume that Ry = Ry,l and Rz = Rz,l as in Figure 11b.

From Equation 1, diamy (Rz,l ) ≤ αdx /(α − 2). Similarly, from Equation 2,
we know that diamy (Ry,l ) ≤ dx /α. Thus, combining the two yields,
diamy (Rz,l ) + diamy (Ry,l )

≤ dx

α
+ dx /α
α−2


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

36

yr
Ry,r
zl
Rz,l
dy

dy

Ry,l
Rz,r

yl

zr

dx

dx

(a)

(b)

Figure 11: Case 3i, for a long rectangle. (a) Two one-cuttable subregions, Ry,r and
Rz,r . (b) Opposing not necessarily one-cuttable subregions, Ry,l and Rz,l , but they
cannot intersect.

1
α
+ )
α−2 α
1
α−2 α
(
+ )
≤ dy
α+1 α−2 α
2
1
(α + 1 − )
= dy
α+1
α
< dy .
= dx (

From this, we know that Rz,l and Ry,l cannot intersect. Therefore, either
Rz = Rz,r or Ry = Ry,r and the region is two-cuttable.
α+1
. Since z l is large, we
• 3ii. (squat rectangles) Now, we have dy < dx α−2
know that Ry,r is a CRT region. Since the rectangle is squat, we know
that Rx,l is also a CRT region, see Figure 12a. Since z r is small, either
Rz,l is a CIT region or Rz,l = R. The latter case arises if maximizing from
z r and z l produces regions which intersect each other. Notice, because of
the dimensions of the region, this is not possible in either the vx or vy
direction. Since dy ≥ dx , Ry,l cannot intersect ∩Ry,r . Notice also that,
for α > 5,

diamx (Rx,l ) ≤
<

dy /α
α+1
dx
α(α − 2)


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

37

Ry,r

Rx,r
dy

dy

Ry,l

Rz,r

Rx,l
dx

dx

(a)

(b)

Figure 12: Case 3ii, for a short rectangle. (a) Two one-cuttable subregions, Rx,l and Ry,r .
(b) Opposing not necessarily one-cuttable subregions, Rx,r and Ry,l . If they intersect,
Rz = Rz,r is a one-cuttable region.

<

dx /2.

The same is true for Rx,r . So, Rx,l cannot intersect Rx,r .
We only need to consider the case when Rx = Rx,r and Ry = Ry,l .
Since both regions contain more than βn points, they must intersect,
see Figure 12b. It follows then that |z r | ≤ 2dx /α. We also know that
|z l | ≤ dx . Recalling that α ≥ 6, we can bound diamz (R), diamz (Rz,r ),
and diamz (Rz,l ) by
diamz (R) ≥


=
diamz (Rz,l ) ≤

diamz (Rz,r ) ≤



dx /2 − |z r |/2
dx /2 − dx /α
dx /2 − dx /6
dx
3
dx
α
dx
6
|z r |
α−2
2dx
2
α − 2α
2dx
24


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

=
diamz (Rz,r ) + diamz (Rz,r ) ≤
=
<


38

dx
12
dx
dx
+
6
12
dx
4
dx
3
diamz (R).

This implies that Rz,l does not intersect Rz,r and similarly cannot intersect
Rx,r ∩ Ry,l . Therefore, we know that Rz = Rz,r . Since Rz,r is a onecuttable CIT region, we know that R must be two-cuttable.
This completes the proof of the two-cut existence theorem.



Theorem 2 Given a point set S in the plane, we can construct a BAR tree
representing a decomposition of the plane into “fat” regions in O(n log n) time.
Proof: To prove this, it suffices to note that a one-cut or a two-cut in any of
the three canonical directions can be found in O(n) time and that the depth of
the tree is O(log n).


4

Using a BAR tree for Cluster Based Drawing

Let G = (V, E) be the graph that we want to draw. Once we obtain the
embedding of G, using whatever algorithm is most appropriate for the graph,
we associate with the graph the smallest bounding square, R, which we call G’s
cluster region. Using the embedding and its cluster region, we create the BAR
tree T , as described above. Each node u ∈ T maintains u.region, u.cluster,
and u.depth. Here u.cluster is the subgraph of G which is properly contained
in u.region. Recall that the depth of the tree T is k = O(log n). In our
application of the tree structure to cluster-based graph drawing, we want every
leaf to be at the same depth. Therefore, we propagate any leaf not at the
maximum depth down the tree until the desired depth is reached. This is merely
conceptual and does not require any additional storage space or change in the
tree structure.
Using the tree T , we create the clustered graph C, which consists of k layers.
Each layer is an embedded subgraph of G along with the regions and clusters
obtained from T . The layers are connected with vertical edges which are simply
the edges in T . The other inputs to LGD are the aspect ratio parameter α and
the balance parameter, β. Here, α determines the maximal aspect ratio of a
cluster region in C, and β determines the cluster balance, the ratio of a cluster’s
size to its parent’s. For a summary of the operations, see Figure 13.
Lemma 6 A call to LGD(G, α, β) for α = 6, β = 2/3 results in 2/3-balanced
clustering with aspect ratio less than or equal to 6 and cluster depth O(log n).


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

39

LGD(G, α, β)
embed(G)
T ← create BAR tree(G, α, β)
C ← create clustered graph(T, G)
display(C)
Figure 13: Main algorithm. The inputs to the algorithm are graph G along with the

aspect ratio parameter α and the balance parameter β. Graph G is embedded in the
plane, after which the BAR tree T is created. Finally, the clustered graph C is created
and displayed.

Proof: By construction, the clusters are β-balanced and the cluster depth is
equivalent to the depth of T . Thus, for α ≥ 6 and β ≥ 2/3 the depth is

O(log1/β n).
Theorem 3 For α ≥ 6, β ≥ 2/3, algorithm LGD creates a 2/3-balanced clustered graph C in O(n log n + m + D0 (G)) time.
Proof: The proof follows directly from the construction of the algorithm and
previous statements about the running time of each component.

Once we obtain the clustered graph C, we can display it as a 3-dimensional
multi-layer graph representing each cluster by either the the convex hull of its
vertices or by its associated region in the BAR tree. Along with the clustered
graph C we can display a particular cluster with more details. Thus we provide
the global structure using the clustered graph and the local detail using the
individual clusters.

4.1

Planar Graphs

When the graph G is planar, we are able to show a few special properties of our
clustered drawings.
Theorem 4 If G is planar, for α ≥ 6, β ≥ 2/3, algorithm LGD creates a 2/3balanced clustered graph C in O(n log n) time. Moreover, C is embedded with
straight lines and no crossings on the n × n × k grid, where k = O(log n).
Proof: We begin with a planar grid embedding with straight-line edges [6, 12,
28] and then the original layer, Gk , is planar. Since each successive layer is a
proper subgraph of the previous layer, it too must be planar and drawn without
edge crossings.

In Figure 14 we can see a clustered graph C = (G, T ) in which the clusters
are represented by the partitions of the plane obtained from the BAR tree. Note
that in this case there is no need to select a representative vertex for a cluster.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

40

Figure 14: A clustered graph C = (G, T ). The clustering of G on the right is obtained
from the BAR tree cuts on the left. Each cluster is represented by the region defined by
the BAR tree cuts. Note the edge-region crossings at the last two levels.


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

41

L

G

G1

G2

Figure 15: Graph G with an inherently large cut. Any cut L which maintains a β-balance
between the clusters, where 1/2 ≤ β < 1, cuts O(n) edges.

For such drawings it is possible to have an edge cross a region that it does
not belong to. Moreover, it is possible to have an edge cross the convex hull of a
cluster that it does not belong to. If we represent a cluster by the convex hulls
of its connected components, however, there will be no such crossings. Thus,
if we could guarantee that each cluster is connected or has a small number of
connected components, the display of the graph can be improved even further.
Alternatively, we can redefine the clusters at each level to be the connected
components of vertices inside each cluster region of the BAR tree. With this
definition of clusters we could then use the algorithm of Eades and Feng [10] to
produce a new clustered embedding of the planar graph so as to have no edge
or region crossings.

4.2

Extensions

Throughout this paper we do not discuss the cut sizes produced by our algorithm, that is the number of edges intersected by a cut line in the BAR tree. In
some applications it is important that the number of such edges cut be as small
as possible. There exist graphs, however, that do not allow for “nice” cuts of
small size. Consider the star graph G on Figure 15. Any cut, which maintains
a β-balance between the two subgraphs it produces, intersects O(n) edges. If
the balance parameter is β = 1/2, the cut contains n2 edges. As this example
shows, we cannot hope to guarantee cut sizes better than O(n). Still, if the
given graph has a small cut then we would like to find a small cut as well.
Minimizing the cut size violates two of our five criteria, namely, speed and
convexity. First of all, looking for the best β-balanced cut is a computationally
expensive operation, and while it can be done in polynomial time, it is not hard
to see that it cannot be done in linear time. In addition, the best β-balanced
cut may not preserve the convex cluster drawing property that LGD maintains.
As shown in Figure 16, this may result in new edge crossings in our clustered
graph.
Our algorithm does not guarantee that it will find the optimum β-balanced


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

42

Figure 16: An example of a graph in which each cluster is represented by a single node.
Note that the non-straight line cut produces a crossing in the multi-level graph.

cut but we can modify the BAR tree construction so that we find locally optimal
cuts. Here are some of the possible criteria that we can use in choosing among
the potential cuts: minimize cut size, minimize connected components resulting
from a given cut, minimize aspect ratio, maximize β-balance.
These criteria can also be combined in various ways to produce desired optimization functions. In finding such optimal cuts, it is important to note that
a one-cut, if available, might not always be a better choice over a potential twocut. Yet again, a two-cut that minimizes the cut size may have no subsequent
one-cut that does not cut many more edges. Thus, it may be reasonable to go
two levels in evaluating possible scores instead of choosing greedily.

5

Conclusion and Open Problems

In this paper we present a straightforward and efficient algorithm for displaying large graphs. The LGD algorithm optimizes cluster balance, cluster depth,
aspect ratio and convexity. Our algorithm does not rely on any specific graph
properties, although various properties can aid in performance, and produces
the clustered graph in a very efficient O(n log n + m + D0 (G)) time.
The embedding of the cluster graph is determined in the very first step of
our algorithm. Unfortunately, it is possible that the initial embedding is not
the best one (for example, in terms of the size of the cuts produced by our


Duncan, Goodrich, and Kobourov, BAR Trees, JGAA, 4(3) 19–46 (2000)

43

4
a
d
4
1
1
3

a

d

2
b

c

2
b

3
a

c

b

Figure 17: The graph in part (a) has no β-balanced line cut of size better than O(n) but
it does have a cycle cut (the dotted circle) of size O(1). We can transform the graph in
(a) to the graph in (b) by taking one of the faces crossed by the cycle as the outer face.
Note that in (b) the cycle cut has become a line and its size is O(1).

algorithm). In fact, as shown on Figure 17, G may have a minimum β-balanced
cut of size O(n) or O(1), depending on the embedding. While it is still true that
some graphs may always have cuts of size O(n) (for example, the star graph,
Figure 15), we would like to minimize the cut whenever we can. It is an open
question whether it is possible to determine the optimal embedding, one that
yields the minimum β-balanced cuts.
Another open question is related to the separator theorems of Lipton and
Tarjan [21] and Miller
√ [22]. Is it possible given a 2-connected planar graph G to
always produce O( dn) β-balanced cuts, where d is its maximum degree, and n
is the number of vertices? If so, can we find an embedding for the resulting clustered graph which preserves efficiency, cluster balance, cluster depth, convexity,
and guarantees good aspect ratio and straight-line drawings without crossings?

Acknowledgements
We would like to thank Rao Kosaraju and David Mount for their helpful comments regarding the balanced aspect ratio tree.


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×