circular graph drawings with large crossing angles

SCHOOL OF INFORMATION TECHNOLOGIES
CIRCULAR GRAPH DRAWINGS WITH LARGE CROSSING ANGLES
TECHNICAL REPORT 691
HOOMAN REISI DEHKORDI, QUAN NGUYEN, PETER EADES, AND SEOK-HEE HONG
NOVEMBER, 2012
Circular Graph Drawings with Large Crossing
Angles
Hooman Reisi Dehkordi, Quan Nguyen, Peter Eades, and Seok-Hee Hong
School of Information Technologies, University of Sydney
{hooman.dehkordi,quan.nguyen,peter.eades,seokhee.hong}@sydney.edu.au
Abstract. This paper is motivated by empirical research that has shown
that increasing the angle of edge crossings reduces the negative effect of
crossings on human readability. We investigate circular graph drawings
(where each vertex lies on a circle) with large crossing angles. In particular, we consider the case of right angle crossing (RAC) drawings, where
each crossing angle is π/2.
We characterize circular RAC graphs that admit a circular RAC drawing, and present a linear-time algorithm for constructing such a drawing, if it exists. We also describe a quadratic programming approach to
construct circular drawings that maximise crossing angles. This method
significantly increases crossing angles compared to the traditional equalspacing algorithm.
Keywords: Graph drawing, Right Angle Crossing (RAC) drawing, Large
Angle Crossing (LAC) drawing, Circular graph drawing
1
Introduction
Since the late 1970s, researchers have studied automatic Graph Drawing, that is,
algorithms to find “good” drawings of graphs. This research is motivated by the
need to visualize biological networks, social networks, computer networks, and
large software structures. One of the most popular graph drawing is a circular
drawing: all the vertices are located on a circle and edges are drawn as straightlines. Consequently, many commercial graph drawing softwares (for example,
TomSawyer software and yworks) produce circular drawings.
Purchase et al. [13] show that human understanding is negatively correlated
to the number of crossings in a drawing. This motivates a large number of algorithms to draw graphs with a small number of crossings. For example, Bauer and
Brandes [3] presented methods for reducing the number of crossings in circular
drawings by computing a good ordering of the vertices on the circle.
Huang et al. [11] show that human understanding is enhanced if angles at
which edges cross is large. A number of investigations on the combinatorics
and algorithmics of drawing graphs with large crossing angles followed Huang’s
work; see, for example, [2, 7, 8, 10]. These papers have concentrated on properties
of right angle crossing (RAC) graph drawings, where each crossing angle is π2 .
2
In this paper, we study circular drawings with large crossing angles. In particular, we concentrate on the right angle crossing case. To construct a circular
graph drawing, we need two steps: (1) order the vertices around the circle to
reduce the number of crossings, and (2) choose locations for the vertices to increase the crossing angles. For the first step, we can use existing methods such
as the Bauer-Brandes [3] algorithm. This paper is concerned with the second
step.
We characterize circular RAC graphs that admit a circular RAC drawing,
and present a linear-time algorithm for constructing such a drawing, if it exists.
The input of the algorithms described in this paper is the clockwise sequence S
of the vertices around the circle as well as the sequence of edges incident with
each vertex u, in clockwise order around u. Once such an input is provided, it is
straightforward to maintain data structures so that we can test in constant time
whether two edges cross each other. Further, we can easily identify and safely
ignore edges between consecutive vertices around the circle.
Note that not every topological graph admits a circular RAC drawing. We
thus study the problem of circular LAC drawings, i.e., circular drawing with
a large crossing angles. We present a quadratic programming approach to construct circular drawings that maximise crossing angles. Experimental results
suggest that this method significantly increases crossing angles compared to the
traditional equal-spacing drawings.
The next Section defines some useful terminology. Section 3 gives a combinatorial characterization of circular RAC graphs, and Section 4 gives a linear-time
algorithm to compute a circular RAC drawing. Section 5 presents a quadratic
programming approach to construct circular drawings that maximise crossing
angles. Section 6 concludes with an open problem.
2
Terminology
We start by reviewing the basic terminology of graph drawing. For further background, see [5].
A drawing of a simple graph G = (V, E) is a representation D of G in the
plane, where each vertex is a point and each edge is a closed Jordan arc between
the points representing its endpoints.
Two edges cross, if they share a point other than their endpoints. A crossing
X = {(a, b), (c, d)} is a set of two distinct edges (a, b) and (c, d) such that (a, b)
crosses (c, d). We define the crossing point x of the crossing X to be the shared
point of (a, b) and (c, d).
In this paper, we assume that graph drawings are not degenerate, in that they
satisfy the following conditions: (1) an edge does not contain a vertex other than
its endpoints; (2) no edge crosses itself; (3) edges must not meet tangentially,
that is, they must either properly cross or not cross at all; and (4) no three edges
share a crossing point.
A topological embedding of a graph G is an equivalence class of drawings of
G under homeomorphism. A topological graph G is an outer topological graph,
3
if and only if all of its vertices are on the same face; we normally assume this
face to be the outer face.
A straight-line drawing of a graph G is a drawing of G in which each edge is
represented by a straight-line segment. A straight-line drawing of a graph G is a
right angle crossing (RAC) drawing, if edges cross each other at an angle of π2 .
A RAC drawing of a graph G is called a circular RAC drawing, if each vertex of
G lies on a circle. We define a circular RAC graph G to be a topological graph
that admits a circular RAC drawing.
The crossing graph Gc of topological graph G is a graph where each vertex
of Gc corresponds to an edge of G and two vertices of Gc are adjacent if and
only if their corresponding edges in G cross each other.
Two crossings X1 = {(a, b), (c, d)} and X2 = {(u, v), (w, x)} are edge disjoint
if and only if X1 ∩ X2 = ∅. Two edge disjoint crossings X1 and X2 cross each
other if an edge of X1 crosses an edge of X2 .
In a connected outer topological graph, vertex v follows vertex u, if and only
if u and v are two consecutive vertices in the sequence of the vertices on the outer
face. We denote such a relation with u ∼ v or v ∼ u. We use u ∼+ v (respectively,
u ∼− v) to denote that u is followed by v in the clockwise (respectively, counter
clockwise) order.
Let a and b be two vertices on a cycle C such that the edge (a, b) is a chord
of C. Let u and v be two vertices of the cycle other than a and b. Then we
define u and v to be on same side of (a, b), if and only if it is possible to reach
v from u by traversing the vertices of C in order without passing through a or
b. Otherwise, we say that u and v are on different sides of (a, b).
In this paper, in order to distinguish between the two sides of an edge e, we
shall call them the left-hand side and the right-hand side of e. For example, if u
and v are on different sides of an edge e and u is on the left-hand side of it, then
v is on the right-hand side of that edge.
We define an edge e0 = (a, b) to be at one side (left-hand side or the righthand side) of another edge e = (u, v), if and only if the two endpoints of it, a and
b, are at the same side of e. Similarly, we define a crossing X1 = {(a, b), (c, d)}
to be at one side (left-hand side or the right-hand side) of an edge e = (u, v), if
and only if its edges, (a, b) and (c, d), are at the same side of e.
_
Suppose that a and b are two points on a circle with center o. Then ab denotes
the clockwise angle ∠aob.
3
A Characterization of Circular RAC Graphs
We now state the main Theorem of this paper.
Theorem 1. An outer topological graph G is a circular RAC graph, if and only
if (1) its corresponding crossing graph is bipartite; and (2) any two edge-disjoint
crossings in G cross each other.
An immediate consequence of Theorem 1 is that the crossing graph of a
circular RAC graph has only one non-trivial connected component. Since the
4
bipartition of a connected bipartite is unique, we can deduce the following two
important Corollaries of Theorem 1.
Corollary 1. A circular RAC drawing can be rotated such that the crossed edges
are either vertical or horizontal.
For the remainder of this paper, we assume that the blue edges are horizontal
and the green edges are vertical.
Corollary 2. Each vertex in a circular RAC graph drawing is incident to at
most two crossed edges. If two crossed edges share an endpoint, then they are
perpendicular to each other.
The next two subsections prove the necessity and sufficiency of the two conditions in Theorem 1.
3.1
Necessity
The necessity of condition (1) of Theorem 1 follows from fundamental results on
RAC graphs in [6].
For condition (2) of Theorem 1, consider Fig. 1. Intuitively, as the minimum
crossing angles at x1 and x2 increase toward π2 , a becomes close to a0 and d
becomes closer to d0 ; if both crossing angles are precisely π2 , then either (a, c)
crosses (a0 , c0 ), or (b, d) crosses (b0 , d0 ). For a formal proof, see Appendix A.
a
a′
b′
b
x1
x2
c
c′
d
d′
Fig. 1: Crossing X1 does not cross crossing X2 .
3.2
Sufficiency
Throughout this section, G = (V, E) denotes an outer topological graph with
a bipartite crossing graph such that any two edge-disjoint crossings in G cross
each other. We shall prove that any graph with such properties has a circular
RAC drawing and hence is a circular RAC graph.
Following [9], we can color the edges of G as follows. An edge is red if it is
not crossed by any other edges. The bipartition of the remaining edges allows to
5
color them blue and green, such that a blue edge is only crossed by green edges
and a green edge is only crossed by blue edges. We denote the sets of red, green
and blue edges of graph G by Er , Eg and Eb respectively.
We first show that the red edges can be eliminated from consideration.
Lemma 1. Suppose that G = (V, E) is an outer topological graph with a bipartite crossing graph such that any two edge-disjoint crossings in G cross each
other. Let Er be the set of the red edges of G, and let Vr denote the set of vertices
that for which all incident edges are red. If there exists a circular RAC drawing
D0 of G0 = (V \ Vr , E \ Er ), then there exists a circular RAC drawing D of G.
Proof. The proof of this Lemma is straightforward (see Appendix B).
From Lemma 1, we now assume that every edge is either blue or green.
We define two isochromatic edges e1 = (u1 , v1 ) and e2 = (u2 , v2 ) of graph G
to be adjoining, if and only if u1 ∼ u2 and v1 ∼ v2 on the outer face of G (see
Figure 2a). We define a blue edge (b, b0 ) and a green edge (g, g 0 ) to be adjoining,
if and only if g ∼− b and g ∼+ b0 (see Figure 2b) or g 0 ∼− b0 and g 0 ∼+ b (see
Figure 2c).
u2 u1
v2 v1
(a)
b
g
g′
(b)
g
b′
b
g ′ b′
(c)
Fig. 2: (a) Two adjoining green edges (u1 , v1 ) and (u2 , v2 ), (b) A blue edge (b, b0 )
which is adjoining to a green edge (g, g 0 ) at vertex g and (c) A blue edge (b, b0 )
which is adjoining to a green edge (g, g 0 ) at vertex g 0 .
The most important part of the proof of sufficiency in Theorem 1 is the
existence of “major” edges. A major green edge of a circular RAC graph drawing
is a green edge which is crossed by all the blue edges. Similarly, we define a major
blue edge. The next Lemma proves the existence of such edges.
Lemma 2. Suppose that G = (V, E) is an outer topological graph with a nonempty
bipartite crossing graph such that any two edge-disjoint crossings in G cross each
other. Then G contains a major green edge and a major blue edge.
Proof. Let g1 be a green edge with a maximum number of crossings; we show
that g1 crosses every blue edge. On the contrary let b1 be a blue edge that does
not cross g1 . But as b1 is blue, it is crossed by a green edge g2 with g2 6= g1 . As
g1 has at least as many crossings as g2 , there is a blue edge b2 that crosses g1 but
6
does not cross g2 . Therefore there are two edge-disjoint crossings X1 = {g1 , b2 }
and X2 = {g2 , b1 } that do not cross each other; this contradicts our assumption.
The Lemma follows.
t
u
The next Lemma exploits the existence of the major green edge and provides
a fundamental base of the drawing algorithm presented later in this section.
Lemma 3. Let eg be a major green edge of G. Then there exists either a blue
edge adjoining to eg or a green edge adjoining to eg .
Proof. See Appendix C.
In a circular RAC drawing D, we define a divider to be the diameter of the
outer circle such that it is parallel to the green edges. The next Theorem provides
a recursive algorithm to construct a circular RAC drawing of G.
Note that the drawing algorithm preserves the given ordering of its vertices
on the outer face. The input of the drawing algorithm also includes a major
edge. An algorithm to find a major edge will be presented in the next Section.
Theorem 2. Let eg be a major green edge of G. Then there exists two different
circular RAC drawings D and D0 of G such that:
– D and D0 differ only by the location of eg ; that is, if we delete eg from both
D and D0 , then D is the same as D0 .
– eg is located on the left side of the divider in D, and on the right side of the
divider in D0 .
– eg is the closest green edge to the center o of the circle Σ in both D and D0
(o is the origin of the coordinate system).
Proof. This proof is by induction on the number of crossing edges of G. Suppose
that G has only one green edge eg and one blue edge eb . Then it is easy to
construct D and D0 such that eg is located on the left side of the divider in D
and on the right side of it in D0 .
Now suppose that G has k+1 crossing edges. By Lemma 3, there exists either
a blue edge eb adjoining to the major edge eg , or a green edge e0g adjoining to
eg . We have the following two cases.
Case 1. There exists a blue edge eb = (b1 , b2 ) adjoining to eg = (g1 , g2 ).
Let G− = (V \ {b1 , b2 }, E \ {eb }) be the graph induced by removing eb and
its endpoints from G. First we show that G− has the necessary properties of
circular RAC graphs, and it does not contain any red edges. Since G has a
bipartite crossing graph, G− has a bipartite subgraph. As eb was adjoining to
eg , after removing eb , all the edges of G− are still either green or blue. Also,
note that since all the crossings in G cross each other, any two crossings in G−
cross each other as well. Therefore, G− has the necessary properties of circular
RAC graphs, and it does not contain any red edges.
Now by induction hypothesis, there exist two circular RAC drawings D−
0
and D− of G− such that all the vertices of G− are located on circle Σ, and
eg = (g1 , g2 ) is the closest green (vertical) edge to o from the left in D− and
7
0
from the right in D− . Since eg is the closest edge to o in both drawings, g1
and g2 have the biggest and smallest y−coordinates among the endpoints of the
green edges. Hence it is easy to add the blue edge eb such that it is adjoining to
eg , and it crosses no other green edge. See Figure 3.
g1
g1
g2
g2
(a)
eb
(b)
Fig. 3: (a) G− without the blue edge (b) G after adding the blue edge
Case 2. There exists a green edge e0g = (g3 , g4 ) adjoining to eg .
Let G− = (V \ {g1 , g2 }, E \ {eg }) be the graph obtained by removing eg and
its endpoints from G. Since we have handled the blue edges adjoining to eg in
Case 1, we now assume that no more blue edges are adjoining to eg . Therefore,
by the removing green edge eg , all the edges of G− are still colored in blue or
green. Also by an argument similar to Case 1, G− has a bipartite crossing graph
and all the crossings in G− cross each other. Therefore, it satisfies the necessary
conditions of circular RAC graphs, and it does not contain any red edges.
Now by the induction hypothesis, the Theorem holds for G− with k crossed
0
edges. That is, G− has two circular RAC drawing D− and D− , such that all
−
0
the vertices of G are located on a circle Σ and eg = (g3 , g4 ) is the closest green
0
(vertical) edge to o from the left in D− and from the right in D− . Next we shall
−0
−
0
show how to add eg to D on the right side of eg or to D on the left side of
e0g , to construct a circular RAC drawing of G.
Without loss of generality, suppose that e0g is located on the left side of eg
in G. That is, we shall add eg to D− on the right side of e0g to construct two
drawings D and D0 of G. Let e0g be located at x = 0 − − in D− , where − is
a positive value smaller than the radius of circle Σ. We add eg to D− at two
x-coordinates x1 and x2 in order to construct D and D0 respectively, such that
0 − − < x1 < 0 and 0 < x2 < 0 + − . That is, eg is located on the left side of
the divider in D and on the right side of the divider in D0 , such that it is closer
to o than e0g and hence any other green edge of the two drawings.
Since e0g is the closest green edge to o in D− and all the horizontal blue edges
in D− cross e0g , no vertex has an x−coordinate between 0 − − and 0 + − . Now
since e0g is located on the left side of the divider in D− , by adding eg at an
x-coordinate between 0 − 0 and 0 + 0 , we can ensure that g3 ∼ g1 and g2 ∼ g4 .
Therefore, we construct D and D0 such that in both drawings, eg is located on
the right side of e0g .
8
As eg is closer to o than any other green edges, the y-coordinate of its upper
endpoint is bigger than the y-coordinate of the upper endpoints of the other
green edges, and the y-coordinate of its lower endpoint is smaller than the ycoordinate of all the other lower endpoints of other green edge. Hence, it crosses
all the existing blue edges.
Note that in both cases, we construct D and D0 , by adding eb and eg to
0
−
D and D− , such that they are adjoining to eg and e0g respectively. Therefore,
we preserve the ordering of the vertices on the outer face of G. The Theorem
follows.
t
u
The algorithm described in the proof of Theorem 2 runs in linear time, since
by Corollary 2, there are at most a linear number of blue and green edges in G.
Next Section describes how to find a major edge in linear time.
4
A Linear-time Circular RAC Drawing Algorithm
In the previous Section, we prove that any outer topological graph G is a circular
RAC graph, if and only if it has a bipartite crossing graph and any two edgedisjoint crossings in G cross each other. Although the proof is constructive, it
requires a major edge as an input of the algorithm. In this Section, we complete
the drawing algorithm by providing a linear-time algorithm to find a major edge.
Theorem 3. There is a linear-time algorithm that tests circular RAC graphs
and constructs a circular RAC drawings if it exists.
Using a double-ended stack, we can eliminate red edges in linear time; for
details, see Appendix D. Henceforth, we assume that the graph has no red edges.
To complete the proof of the Theorem, we need to show that the major edges
can be found in linear time. We shall assume that G is a circular RAC graph
without any red edges.
To find a major edge, we first find an edge e, which is crossed a small number
of times. Then we search for a major edge among the edges crossing e. We define
a green side edge of a circular RAC graph G to be a green edge of G such
that it has only one green adjoining edge. Similarly, we define a blue side edge.
Intuitively, a green (respectively, blue) side edge is an edge where it has no other
green (respectively, blue) edges on at least one side of it. Figure 4a shows the
side edges of a circular RAC graph.
We also define an edge e0 to be parallel with an edge e, if and only if e and
0
e do not cross each other. That is, in a circular RAC graph G, e0 is parallel to
e, if both of the endpoints of e0 are on the same side of e.
It is useful to note that we can test whether two edges cross or are parallel
in constant time, just by checking the indices of their endpoints in the sequence
of the vertices on the outer face. The next Lemma shows how to find side edges
in linear time.
Lemma 4. Let G be a circular RAC graph with no red edges. Given a sequence
of vertices on the boundary of G, there is a linear-time algorithm to find a side
edge e of G.
9
(a)
(b)
Fig. 4: (a)The dashed edges indicate the side edges, (b) the traversal path to find
a side edge.
Proof. In order to find a side edge in linear time, we sweep the parallel edges of
graph G such that no edge is visited twice. Suppose that during the sweep, we
encounter the parallel edges in the following order, e1 , e2 , . . . , ek . If, for each i,
the i-th edge is on the left-hand side (or right-hand side) of the (i − 1)-th edge,
then no edge is visited twice. We describe this sweeping process more rigourously
next.
Choose a direction d to be either clockwise or counter clockwise. Pick an
arbitrary vertex u to initiate the sweep. Follow the crossed edge e1 incident to
u, in order to reach its other endpoint u0 . Traverse the circular boundary from
u0 in direction d, until we reach a vertex v of an edge e2 , that is parallel to
edge e1 (the new edge might not be of the same color of the first one). Then
start searching for the next parallel edge by traversing the circle from the other
endpoint of e2 , namely v 0 , in a direction d0 , opposite to d. Repeat this process,
until we reach an edge ek such that there are no more parallel edges on one side
of it. This sweeping process is shown in Figure 4b.
The “clockwise/counter clockwise” alternation in the algorithm is to make
sure that we are advancing towards one side of the cycle. Hence, no vertex is
visited more than once, and therefore it guarantees that the algorithm runs in
linear time.
t
u
Now we have found a side edge. Next, we describe an algorithm for finding
a major edge. From Lemma 2, there is a major edge that crosses the side edge.
Further note that all the edges crossing the side edge are isochromatic.
Lemma 5. Let G be a circular RAC graph with no red edges. Given a sequence
S of vertices on the outer face of G and a side edge (u, v) as input, there exists
a linear-time algorithm to find a major edge m of G.
Proof. Without loss of generality, let (u, v) be a green edge. Since (u, v) is a
side edge, there are no parallel edges on one side of it. Let u0 be the consecutive
vertex to u on that side of (u, v), where there are no parallel edges. Similarly,
let u00 be the consecutive vertex to v on that side of (u, v), where there are no
parallel edges (see Figure 5a). Name the other endpoints of the edges incident
10
to u0 and u00 as v 0 and v 00 correspondingly. Obviously, (u0 , v 0 ) and (u00 , v 00 ) are
blue edges. Let d be the direction of which we traverse S to reach u0 from u. We
start traversing the cycle from v 0 in the opposite direction of d, until we reach
v 00 or two endpoints m and n of an edge (m, n), such that (m, n) is not among
the set E of the edges crossing (u, v).
Then we have the following three cases:
1. We reach v 00 and there is a vertex m (but not a vertex n) between v 0 and v 00 ,
such that m does not belong to any of the edges in E: Then, either (u0 , v 0 )
or (u00 , v 00 ) is a major edge.
2. We reach v 00 and all the vertices between v 0 and v 00 are incident to edges of
E: Then, all of these edges are major edges.
3. We reach n: Then, those edges of E which cross (m, n) are major edges.
Case 1. We reach v 00 and there is a vertex m (but not a vertex n)
between v 0 and v 00 (see Figure 5b).
Suppose that m is a vertex between v 0 and v 00 , which is not an endpoint of
the edges in E. Let us call the other endpoint of the edge incident to m as n.
Since n is not between v 0 and v 00 on S, it is either located between v 00 and v or
between u and v 0 in the clockwise order. Without loss of generality assume that
n is located between u and v 0 , and hence it crosses (u0 , v 0 ). Now, note that no
green edge e is incident to two vertices between m and v (or between n and u),
since otherwise no blue edge can cross e, (u, v) and (m, n) simultaneously, which
contradicts Lemma 2. Hence, (u0 , v 0 ) crosses all the blue edges and is a major
edge.
u
u′
v′
v′′
u′′
v
n
u
u′
u′′
v′′
u
u′
v′
m
w
n
v′′
x
u′′
v
v
(a)
v′
m
(b)
(c)
Fig. 5: The traversal path to find a major edge.
Case 2. We reach v 00 and all the vertices between v 0 and v 00 are
incident to edges of E.
Clearly, by Lemma 2, at least one of the edges in E is a major edge. Since
there exists no vertex m or n between the endpoints of these edges, none of them
has more crossings than the others. Hence, all of them are major edges.
Case 3. We reach n (see Figure 5c).
Obviously, the major edges of G cross both edges (u, v) and (m, n). Since no
vertex is located between the endpoints of the edges crossing (u, v) and (m, n),
11
none of them have more crossings than the others. Hence, all of them are major
edges.
The Lemma follows.
t
u
Lemma 5 completes the proof of Theorem 3.
The overall drawing algorithm can be described as follows:
1.
2.
3.
4.
Identify and delete the red edges.
Find a side edge, using the algorithm in the proof of Lemma 4
Find a major edge, using the algorithm in the proof of Lemma 5.
Using the recursive algorithm in the proof of Theorem 2, draw the blue and
green edges.
5. Draw the red edges.
5
Circular Drawings with Large Angle Crossings
The results of the previous Sections are useful when a RAC drawing is possible.
However, in many cases, such a drawing is not possible. In this Section, we
describe a practical quadratic programming approach for increasing crossing
angles in a circular drawing.
Again, we assume that the ordering (u0 , u2 , . . . , un−1 ) of the vertices around
the circle is computed by a crossing reduction algorithm in [3]. The quadratic
programming approach was first reported in [12] as a poster.
As noted in Section 4, red edges can be eliminated. The partition of the
remaining edges into blue and green is straightforward using the circular ordering
given in the input.
We assume that the vertices are drawn on a unit circle, centered at the origin.
The next step is to find, for each i, the angle θi that the line from the origin to
ui makes with the x axis. We assume that θ0 = 0.
Suppose that edge e = (ui , uj ) crosses edge e0 = (ui0 , uj 0 ), where θi < θj and
θi0 < θj 0 . Then the crossing angle α(e, e0 ) between e and e0 can be written as a
linear function of θi , θj , θi0 and θj 0 . The sum of squares error in crossing angles
is:
X π 2
F =
α(e,e0 ) −
,
(1)
2
0
(e,e )∈Ω
where Ω denote the set of pairs of crossing edges.
The ordering of vertices around the circle induces a set of linear constraints
for the θi . In practice, we need further constraints. The vertex resolution of
a drawing is the minimum distance between two vertices, given a fixed size
enclosing rectangle for the drawing. To ensure reasonable vertex resolution, we
enforce an angular gap g between vertices, that is, θi + g < θi+1 for i < n − 1
and θn−1 ≤ 2π. We can minimise the function F in equation (1) subject to these
gap constraints using standard quadratic programming methods.
Using the Rome data set [1], CPLEX, and a relatively old CPU, we tested this
method. The execution time varied around 10ms, which is very little overhead on
12
the Bauer-Brandes algorithm. We found a significant improvement in crossing
angles over the simple approach of equally spacing vertices around the circle. T
he improvement varied, depending on the chosen value of the gap g, but averaged
around 60%.
6
Conclusion
In this paper, we have characterized circular RAC graphs and provided a lineartime algorithm to construct a circular RAC drawing. We also presented a practical quadratic programming approach for crossing angle maximisation.
In future, we would like to extend our work to find a characterization of
outer RAC graphs, that is, graphs which have a RAC drawing in which every
vertex appears on the outside face. Further preliminary work toward this goal is
presented in [4].
References
1. The Rome graphs. http://www.graphdrawing.org/data/index.html, 2010.
2. E. N. Argyriou, M. A. Bekos, and A. Symvonis. The straight-line rac drawing
problem is np-hard. In Proceedings of the 37th international conference on Current trends in theory and practice of computer science, SOFSEM’11, pages 74–85,
Berlin, Heidelberg, 2011. Springer-Verlag.
3. M. Baur and U. Brandes. Crossing reduction in circular layouts. In WG 2004,
Volume 3353 of LNCS, pages 332–343. Springer, 2004.
4. H. R. Dehkordi and P. Eades. Every outer-1-plane graph has a right angle crossing drawing. International Journal of Computational Geometry and Applications,
2012. to appear.
5. G. Di Battista, P. Eades, R. Tamassia, and I. G. Tollis. Graph Drawing: Algorithms
for the Visualization of Graphs. Prentice Hall, July 1998.
6. W. Didimo, P. Eades, and G. Liotta. Drawing graphs with right angle crossings. In
WADS ’09: Proceedings of the 11th International Symposium on Algorithms and
Data Structures, pages 206–217, Berlin, Heidelberg, 2009. Springer-Verlag.
7. W. Didimo, P. Eades, and G. Liotta. Drawing graphs with right angle crossings.
Theoretical Computer Science, 412(39):5156 – 5166, 2011.
8. V. Dujmovic, J. Gudmundsson, P. Morin, and T. Wolle. Notes on large angle
crossing graphs. Computing: the Australasian Theory Symposium, 2010.
9. P. Eades and G. Liotta. Right angle crossing graphs and 1-planarity. In Graph
Drawing, pages 148–153, 2011.
10. E. Di Giacomo, W. Didimo, P. Eades, and G. Liotta. 2-layer right angle crossing
drawings. In IWOCA, pages 156–169, 2011.
11. W. Huang, S.H. Hong, and P. Eades. Effects of crossing angles. In IEEE Pacific
Visualization Symposium, pages 41–46, 2008.
12. Q. H. Nguyen, P. Eades, S.H. Hong, and W. Huang. Large crossing angles in
circular layouts. In Ulrik Brandes and Sabine Cornelsen, editors, Graph Drawing,
volume 6502 of Lecture Notes in Computer Science, pages 397–399. Springer, 2010.
13. H. C. Purchase, R. F. Cohen, and M. James. Validating graph drawing aesthetics. In GD ’95: Proceedings of the Symposium on Graph Drawing, pages 435–446,
London, UK, 1996. Springer-Verlag.
13
APPENDICES
A
Proof of necessity in Theorem 1
Let a, b, c, d, a0 , b0 , c0 and d0 be eight different vertices of V , and let X1 = {(a, c), (b, d)}
and X2 = {(a0 , c0 ), (b0 , d0 )} be two edge-disjoint crossings in G. We shall show
that at least one edge of X1 crosses an edge of X2 .
Let D be a circular RAC drawing of G, and let circle Σ be the circle on
which the vertices of G lie in D. Also, let x1 and x2 be the two crossing points of
X1 and X2 , respectively. Now, to the contrary, suppose that there is no crossing
between the edges of X1 and X2 (see Figure 1).
_
The drawing D is a RAC drawing; therefore, ∠ax1 d =
∠a0 x2 d0 =
_
_
0
_
0 0
_
0 0
d a +b c
2
_
0
=
_
_
_
0 0
π
2
_
_
0 0
_
_
0 0
_
ad+cb
2
=
π
2
and
and hence ad + cb + d a + b c = 2π. However,
_
0 0
_
_
_
ad=aa + a d + d d and d a =d0 d + da + aa0 and hence:
_
_
_
_
_
_
aa0 + a0 d0 + d0 d + cb + d0 d + da + aa0 + b0 c0 = 2π.
_
_
_
_
_
_
_
_
However, also aa0 + a0 d0 + d0 d + da= 2π, and thus, cb=d0 d=aa0 =b0 c0 = 0,
which is a contradiction.
t
u
B
Proof of Lemma 1
We prove by induction on the number of the red edges of graph G. In the base
case, Er = ∅, and the lemma is trivial.
Let Gk+1 = (V, E) be a circular RAC graph with k red edges, and let Gk =
(V, E \ {e}) be a graph induced by deleting a red edge e = (u, v) from Gk+1 .
By induction hypothesis, there exists a circular RAC drawing Dk of Gk .
Obviously, such a drawing would decompose the plane into some regions, where
each region corresponds to a face of the drawing. Since (u, v) is a red edge, u and
v are located on the boundary of the same region R of the plane. Next we show
that region R is a convex region, and hence it is possible to add a straight-line
segment between any two points in this region.
Let R be an arbitrary region of the plane in the drawing Dk . Clearly, such
a region is formed by the intersection of a couple of regions, each of which is
bounded by an edge on one side and a portion of the circle on the other side
(see Figure 6). Since this kind of region is convex, their intersection R is convex.
The lemma follows.
C
Proof of Lemma 3
Let eg = (g1 , g1 0 ). Since (g1 , g1 0 ) is crossed by all the blue edges, clearly no two
vertices of the same blue edge can be located on the same side of it. Also as no
14
u
(a)
(b)
(c)
v
(d)
Fig. 6: Adding a red edge (u, v) to a convex region R.
two green edges cross each other, there are no two vertices of the same green
edge, that are located on different sides of the edge.
Knowing the above facts, suppose that there exists a blue vertex b1 which
is adjacent to g1 on the outer face (see Figure 7). Without loss of generality,
suppose that b1 is located to the left side of edge (g1 , g1 0 ) (i.e., g1 ∼− bk ). Then,
there should be a blue vertex b1 0 on the right-hand side of edge (g1 , g1 0 ).
If b1 0 is adjacent to g1 , then the Lemma follows. Otherwise, suppose that
there exists another vertex u between b1 0 and g1 , such that g1 ∼+ u. Vertex
u cannot be incident to a blue edge, since otherwise we have one of the two
following impossible cases: either (1) the other endpoint of this blue edge is
located between b1 and g1 , or (2) it crosses (b1 , b1 0 ).
So let u be a green vertex denoted by g2 . Since g2 is on the right side of
(g1 , g1 0 ), there should also be a green vertex g2 0 on the right side of edge (g1 , g1 0 ).
If g2 0 is adjacent to g1 0 , then the lemma follows. So let a vertex v be located
between g2 0 and g1 0 , such that b2 ∼+ g1 0 . This vertex cannot be green, since
otherwise its corresponding green edge would cross one of the two green edges
of (g1 , g1 0 ) or (g2 , g2 0 ).
So let v be a blue vertex denoted by b2 . Since b2 is located on the right side
of (g1 , g1 0 ), there exists a vertex b2 0 on the left side of (g1 , g1 0 ).
Now, if b2 0 is adjacent to g1 0 , then the lemma would follow. So let a vertex
w be located between b2 0 and g1 0 , such that g1 0 ∼+ w. Vertex w is not a blue
vertex, since otherwise its corresponding blue edge would cross (b2 , b2 0 ). So let
it be a green vertex denoted by g3 , which is incident to (g3 , g3 0 ).
Now g3 0 is on the left-hand side of (g1 , g1 0 ), however it cannot follow g1 ,
since by our assumption, b1 is the adjacent vertex to g1 on the left hand side
of (g1 , g1 0 ). That is, there are two crossings X1 = {(g2 , g2 0 ), (b1 , b1 0 )} and X2 =
{(g3 , g3 0 ), (b2 , b2 0 )}, such that they do not cross each other, which is a contradiction.
The same reasoning applies to all the other cases, where there exists a green
vertex adjacent to g1 , or where there exists a blue or green vertex adjacent to
g1 0 . Thus the Lemma follows.
D
Algorithm to Eliminate Red Edges
Obviously, no red edge e exists in G such that there are two crossings X1 and
X2 at both sides (otherwise, X1 does not cross X2 , which is a contradiction). A
direct consequence of this fact and the fact that G has a finite number of edges
15
g1
g′3
b1
b2′
w=g3
u=g2
g1′ v=b2
b1′
g2′
Fig. 7: In a circular RAC drawing, there exists either a blue or a green edge
adjoining to the major green edge.
is that in any circular RAC graph G, there exists a red edge er such that there
are no edges on one side of it. That is, the endpoints of er are consecutively
located in the given sequence S. Clearly, by removing this red edge, G is still
a circular RAC graph. Hence, it is possible to repeat the same argument, and
delete all the red edges of G.
Next, we show that using the same fact and a proper data structure, it is
possible to find all these edges in linear time.
Lemma 6. Given the sequence S of the vertices on the outer face of a circular
RAC graph G, there exists a linear-time algorithm for identifying the red edges
of G.
Proof. We first present an algorithm.
Choose any vertex w in S as the starting point, and traverse the vertices on
the outer face of G in the clockwise order. Whenever we reach a new vertex v,
we mark its corresponding edge e = (u, v) as “processed”, and push it into the
stack. If e is already marked as “processed”, check if the other endpoint of e
(i.e., u) is at the top or at the bottom of the stack; if that is the case, mark e as
red, and pop u. We continue traversing S cyclically, until we reach the vertex w
again.
Let us analyze correctness of the above algorithm. Here the loop invariant is
that the red edges are removed, when their second endpoint is processed. This
invariant trivially holds for the base case. Hence, we shall explain the inductive
case next.
Let e = (u, v) be a red edge. Assume that vertex u is already processed and
is pushed into the stack, and we have just reached vertex v. The inductive
hypothesis implies that all the red edges, whose both endpoints were processed
previously, are deleted from the stack. Recall that since e is a red edge, there
is nothing else than red edges at one side of it. Therefore, as we are about to
reach the second endpoint of e, we have already processed and removed all the
16
red edges and vertices, which were on one side of e. Hence, u should be either
located at the top or the bottom of the stack.
Since we traversed the vertices of the graph once, the algorithm takes linear
time.
ISBN 978-1-74210-296-2
School of Information Technologies
Faculty of Engineering & Information
Technologies
Level 2, SIT Building, J12
The University of Sydney
NSW 2006 Australia
T +61 2 9351 3423
F +61 2 9351 3838
E [email protected]
sydney.edu.au/it
ABN 15 211 513 464
CRICOS 00026A