Upward Planar Drawing of Single Source Acyclic Digraphs
(Extended Abstract)
y z
Michael D. Hutton Anna Lubiw
UniversityofWaterlo o UniversityofWaterlo o
convention, the edges in the diagrams in this pap er Abstract
are directed upward unless sp eci cally stated otherwise,
An upward plane drawing of a directed acyclic graph is a
and direction arrows are omitted unless necessary.The
plane drawing of the graph in which each directed edge is
digraph on the left is upward planar: an upward plane
represented as a curve monotone increasing in the vertical
drawing is given. The digraph on the rightisnot
direction. Thomassen [14 ] has given a non-algorithmic,
upward planar|though it is planar, since placing v
graph-theoretic characterization of those directed graphs
inside the face f would eliminate crossings, at the
with a single source that admit an upward plane drawing.
cost of pro ducing a downward edge. Kelly [10] and
We present an ecient algorithm to test whether a given
single-source acyclic digraph has an upward plane drawing
v
and, if so, to nd a representation of one suchdrawing.
The algorithm decomp oses the graph into biconnected
and triconnected comp onents, and de nes conditions for
merging the comp onents into an upward plane drawing of
the original graph. To handle the triconnected comp onents
f
we provide a linear algorithm to test whether a given plane
drawing admits an upward plane drawing with the same
faces and outer face, which also gives a simpler, algorithmic
Upward planar Non-upward-planar
pro of of Thomassen's result. The entire testing algorithm
(for general single-source directed acyclic graphs) op erates
2
in O (n ) time and O (n) space.
Figure 1: Upward planar and non-upward planar
graphs.
1 Intro duction
There are a wide range of results dealing with drawing,
Kelly and Rival [11]have shown that for every upward
representing, or testing planarity of graphs. Fary [4]
plane drawing there exists a straight-line upward plane
showed that every planar graph can b e drawn in the
drawing with the same faces and outer face, in which
plane using only straight line segments for the edges.
every edge is represented as a straight line segment.
Tutte [15] showed that every 3-connected planar graph
This is an analogue of Fary's result for general planar
admits a convex straight-line drawing, where the facial
graphs. The problem of recognizing upward planar
cycles other than the unb ounded face are all convex
digraphs is not known to b e in P, nor known to
p olygons. The rst linear time algorithm for testing
b e NP-hard. For the case of single-source single-
planarityofa graphwas given by Hop croft and Tarjan
sink digraphs there is a p olynomial time recognition
[6].
algorithm provided by Platt's result [12] that sucha
An upward plane drawing of a digraph is a plane
graph is upward planar i the graph with a source-
drawing such that each directed arc is represented as
to-sink edge added is planar. An algorithm to nd
a curve monotone increasing in the y -direction. In
an upward plane drawing of such a graph was given
particular the graph must b e a directed acyclic graph
DiBattista and Tamassia [2].
(DAG). A digraph is upward planar if it has an upward
In this pap er we will solve these problems for
plane drawing. Consider the digraphs in Figure 1. By
single-source digraphs. For the most part we will b e
concerned only with constructing an upward planar
representation|enough combinatorial information to
Supp orted in part by NSERC.
y
sp ecify an upward plane drawing without giving actual
Currently [email protected].
z
Currently [email protected] o.edu. numerical co ordinates for the vertices. This notion will 1
Upward Planar Drawing of Digraphs 2
vertices, GnS denotes G with the vertices in S and all b e made precise in Section 3. We will remark on the
edges incidenttovertices in S removed. If S contains a extension to a drawing algorithm in the Conclusions.
2
single vertex v we will use the notation Gnv rather than Our main result is an O (n ) algorithm to test whether
Gnfv g. G is k -connected if the removal of at least k ver- a given single-source digraph is upward planar, and if
tices is required to disconnect the graph. By Menger's so, to giveanupward planar representation for it. This
Theorem [1] G is k -connected if and only if there ex- result is based on a graph-theoretic result of Thomassen
ist k vertex-disjoint undirected paths b etween anytwo [14, Theorem 5.1]:
vertices. Asetofvertices whose removal disconnects
Theorem 1.1. (Thomassen) Let bea plane
the graph is a cut-set. The terms cut vertex and sepa-
drawing of a single-source digraph G. Then thereex-
0
ration pair apply to cut-sets of size one and two resp ec-
ists an upward plane drawing strongly equivalent to
tively. A graph whichhasnocutvertex is biconnected
(i.e. having the same faces and outer faceas) if and
(2-connected). A graph with no separation pair is tri-
only if the source of G is on the outer faceof , and
connected (3-connected). For G with cut vertex v ,a
for every cycle in , has a vertex which is not
component of G with resp ect to v is formed from a con-
the tail of any directededge inside or on .
nected comp onent H of Gnv byaddingto H the vertex
The necessity of Thomassen's condition is clear: for
0
v and all edges b etween v and H .For G with separation
a graph G with upward plane drawing , and for any
0
pair fu; v g,acomponent of G with resp ect to fu; v g is
cycle of , the vertex of with highest y -co ordinate
formed from a connected comp onent H of Gnfu; v g by
cannot b e the tail of an edge of , nor the tail of an
adding to H the vertices u; v and all edges b etween u; v
edge whose head is inside .
and vertices of H . The edge (u; v ), if it exists, forms
Thomassen notes that a 3-connected graph has a
acomponentby itself. An algorithm for nding tricon-
unique planar emb edding (up to the choice of the outer
1
nected comp onents in linear time is given in Hop croft
face) and concludes that his theorem provides a \go o d
and Tarjan [7]. A related concept is that of graph union.
characterization" of 3-connected upward planar graphs
We de ne G [ G , for comp onents with \shared" ver-
1 2
(i.e. puts the class of 3-connected upward planar graphs
tices to b e the inclusive union of all vertices and edges.
in NP intersect co-NP). An ecient algorithm is not
That is, for v in b oth G and G , the vertex v in G [ G
1 2 1 2
given however, nor do es Thomassen address the issue of
is adjacent to edges in each of the subgraphs G and G .
1 2
non-3-connected graphs.
Contracting an edge e =(u; v )inG results in a
The problem thus decomp oses into two main issues.
graph, denoted G=e, with the edge e removed, and
The rst is to describ e Thomassen's result algorithmi-
vertices u and v identi ed. Inserting new vertices within
cally; we do this in Section 4 with a linear time algo-
edges of G generates a subdivision of G. A directed
rithm, which provides an alternative pro of of his the-
subdivision of a digraph results from rep eatedly adding
orem. The second issue is to isolate the triconnected
anewvertex w to divide an edge (u; v )into (u; w )
comp onents of the input graph, and determine howto
and (w; v). G and G are homeomorphic if b oth are
1 2
put the \pieces" back together after the emb edding of
sub divisions of some other graph. G is planar if and
each is complete. This more complex issue is treated
only if every sub division of G is planar [1].
in Section 5. The combined testing/emb edding algo-
In a directed graph, the in-degree ofavertex v is
rithm is left out due to space constraints; a full version