Table Of ContentTowards an optimal algorithm for recognizing Laman graphs∗
OvidiuDaescu† AnastasiaKurdia‡
8
0
0
Abstract
2
n
Lamangraphsarefundamentaltorigiditytheory.Incomputationalgeometry,theyarecloselyrelated
a
to pointedpseudo-triangulationsof planarpointsets througha propertythatstates thatthe underlying
J
graphsofpointedpseudo-triangulationsareLamangraphs. AgraphGwithnverticesandmedgesisa
5
1 Lamangraph,orequivalentlyagenericminimallyrigidgraph,ifm=2n−3andeveryinducedsubset
ofkverticesspansatmost2k−3edges.
] We discuss the problem of recognizing Laman graphs. Specifically, we consider the Verification
O
problem: GivenagraphGwithnvertices,decideifitisLaman.
C ThepreviouslybestknownalgorithmfortheverificationproblemtakesO(n3/2)time. Inthiswork
h. we presentan algorithmthattakes O(Tst(n)+nlogn) time, where Tst(n) is the best time to extract
t twoedgedisjointspanningtreesfromGordecidenosuchtreesexist. Sofar,itisknownthatT (n)is
a st
m O(n3/2). Ouralgorithmexploitsaknownconstructioncalledred-blackhierarchy(RBH),thatisacer-
tificateforLamangraphs. PreviousalgorithmsconstructthehierarchyinO(n2)time. Ourcontribution
[
istwo-fold.First,weshowhowtoverifyifGadmitsanRBHinO(nlogn)timeandarguethisisenough
1 toconcludewhetherGisLamanornot. Second,weshowthattheRBHcanbeactuallyconstructedin
v O(nlogn)timeusingatwostepsprocedurethatissimpleandeasytoimplement.
4
Finally,we pointoutsomedifficultiesin usingred-blackhierarchiestocomputea Hennebergcon-
0
struction, which seem to imply super-quadratic time algorithms when used for embedding a planar
4
2 Lamangraphasapointedpseudo-triangulation.
.
1
0
8
0
:
v
i
X
r
a
∗TheauthorswouldliketothankIleanaStreinufororganizingthe2005and2006Barbadosworkshops,partiallysupportedby
NSF.Thisworkwouldnothavebeenpossiblewithoutparticipationinthoseworkshops.
†Department of Computer Science, University of Texas at Dallas, Richardson, TX 75080, USA. E-mail:
[email protected]’sresearchissupportedinpartbyNSFawardCCF-0635013.
‡Department of Computer Science, University of Texas at Dallas, Richardson, TX 75080, USA. E-mail:
[email protected]
1
1 Introduction
Generic minimally rigid graphs in the plane, also known as Laman graphs, are fundamental to rigidity
theory[11,4]. AgraphGwithnvertices andmedgesisaLamangraphifm = 2n−3andeveryinduced
subsetofkverticesspansatmost2k−3edges. Incomputationalgeometry,theyarecloselyrelatedtopointed
pseudo-triangulationsofplanarpointsetsthroughapropertythatstatesthattheunderlyinggraphsofpointed
pseudo-triangulations are Lamangraphs [11]. Thus, pointed pseudo-triangluations inherit theproperties of
Laman graphs. For example, related to the work in this paper, it follows that if we double any edge of
a given pointed pseudo-triangulation then its underlying graph can be decomposed in two edge disjoint
spanning trees. Moreover, while not all Laman graphs can be embedded as pointed pseudo-triangulations,
everyplanarLamangraphcanbeembeddedasapointed pseudo-triangulation [4].
InthispaperweconsiderrecognizingLamangraphs. Specifically,weaddresstheVerificationproblem:
GivenagraphGwithnvertices, decideifitisLaman.
Most existing verification algorithms take quadratic time in the number of input vertices to recognize
Laman graphs [7, 1]. A very elegant and simple algorithm is the pebble game algorithm, first proposed by
JacobsandHendrickson[5],andgeneralizedlateronbyStreinu,Lee,andTheraninanumberofpapers[12,
2
6,13,3]. Thepebblegamealgorithm solvestheverificationproblem inO(n )time.
Recski[10]andLovaszandYemini[8]provedthatagraphG = (V,E)isLamanifandonlyif,foreach
edge e ∈ E, the multigraph G∪{e} is the union of two edge disjoint spanning trees. In the remaining of
thissectionweassumeanedgeofGhasbeendoubled andGdenotes theresulting graph.
Aknownsubquadratic timealgorithm isduetoGabowandWestermann[2]andrequires O(n3/2)time.
They solve this problem in two steps: (1) Find a 2-forest of G(two edge disjoint spanning trees), which is
doneinO(n3/2)time,and(2)Testifthetopclumpisempty: thisisdoneinO(nlogn)timeandusessome
structures computedinstep(1). Thus,step(2)iscoupledwithstep(1),inthesensethatiftwoedgedisjoint
spanning trees are given to step (2), computed by some arbitrary method, then step (2) should be changed
and could require asymptotically larger time. Veryrecently, itwassuggested tousthat amethod presented
in[13]canbe adapted tospeed upthe top clumptest toO(n)time, assuming the data structures computed
instep(1)areavailable.
A different verification algorithm was proposed recently by Bereg [1]. The method in [1] performs a
step-by-step decomposition of G, aiming to construct a hierarchical decomposition H of G, called a red-
blackhierarchy(RBH).Itisarguedin[1]thatGisaLamangraphifandonlyifitadmitsaRBH.TheRBH
constructionin[1]hasthreesteps: (1)Findtwoedgedisjointspanningtrees,bysomemethod(Beregusesan
O(n2)timealgorithmtoobtainthetrees,buthecouldhaveusedthealgorithmin [2],forO(n3/2)time);(2)
2
Constructared-blackhierarchy,whichisdoneinO(n )time,and(3)Certifythehierarchy,whichisdonein
O(n)time. Since steps (2)and (3) donot depend onhow step (1)isperformed, Bereg’s method decouples
the computation of the two edge disjoint spanning trees in step (1) from the rest of the computation. Let
T (n) be the time to find two edge disjoint spanning trees. Step (1) takes O(T (n)) time, step (2) takes
st st
2 2
O(n )time[1],andstep(3)takesO(n)time,totalingO(T (n)+n )time.
st
Wepresent anO(T (n)+nlogn)time verification algorithm based onthe following simple observa-
st
tion: from Corollary 4 in [1], it is not necessary to actually construct H to decide G is Laman; we only
need to decide whether a RBH decomposition H exists for G. Thus, steps (2) and (3) above from Bereg’s
algorithm become: (2)usethetwospanning treestodecidewhetherGadmitsaRBHdecomposition.
Ouralgorithmhastwosteps: (1)Computetwoedgedisjointspanningtreesbythebestpossiblemethod.
We use the algorithm in [2] since this is the best we know (if, say, a simple O(nlogn) time algorithm is
1
discovered for this part, we will use that one). This step takes O(n3/2) time. (2) Given two edge disjoint
spanning trees forG, wegive asimple solution fordeciding whether Gadmits aRBHdecomposition, that
uses depth-first search and segment trees only, and takes O(nlogn)time. This step is independent of how
step (1) is done. At the end of step (2) we know if G is Laman or not. Moreover, we also show that the
RBHcan beactually constructed in O(nlogn)timeusing atwosteps procedure that issimple and easy to
implement. Thus,ouralgorithm decouples step(1)fromstep(2),achieving thedesirable featureofBereg’s
method(totakeadvantageoffutureimprovementsonstep(1)),andsolvesthesecondstepoftheverification
2
inO(nlogn)timeinsteadofO(n )time.
Finally, we point out some difficulties in using red-black hierarchies to compute a Henneberg con-
struction, which seem to imply super-quadratic time algorithms when red-black hierarchies are used for
embedding aplanarLamangraphasapointed pseudo-triangulation.
2 Red-black hierarchies
Red-blackhierarchies (RBH)areintroduced in[1]asfollows.
A hierarchy H(G,T ,α,β) for a given graph G(E,V), |V| = n, is a graph H(E ,V ), E = T ∪
h h h h h
β(E). T is a set of edges forming a rooted tree. The function α : V → L(T ), defines a one-to-one
h h
correspondence between the vertices of V and the leaves of the tree, denoted as L(T ). The function
h
β : E → V(Th) × V(Th) maps an edge (u,v) of G to the edge β(u,v) = (β1(u,v),β2(u,v)) of H
(called cross edge), so that β1(u,v) and β2(u,v) are ancestors, but not common ancestors, of α(u) and
α(v),respectively.
ARBHisahierarchyH(G,T ,α,β)satisfyingthefollowingconditions: (1)TherootofthetreeT has
h h
exactlytwochildren(rootrule);(2)Avertexistheonlychildofitsparentifandonlyifitisaleaf(leafrule);
(3)Foranycross edge itsendpoints have the samegrandparent but different parents inthetree (cross-edge
rule);(4)Crossedgesconnectallgrandchildren ofavertexandformatree(treerule).
Given G, the construction of the RBH in [1] has two major phases. First, a copy of an edge of G,
e ,isaddedtoGandtwoedge-disjoint spanning trees,Tr (calledredtree)andTb (calledblacktree),are
add
computed forG∗ = G∪{e }usingaknownmethod (ifnosuchtreesexist, thenGisnotLamanandwe
add
stop). AgraphG∗ anditstwoedgedisjointspanning treesareshowninFigure1. Second,adecomposition
of G∗ is performed and a characterizing hierarchy H = H(G∗) is constructed in correspondence with the
stepsofthedecomposition. Wedescribethisdecomposition [1]below.
Supposee ∈ TbandletE(G∗)= Tr∪Tb. Inthefirststep,arootr ,corresponding toTr,iscreated
add h
inH andiscoloredred. Inthesecondstep,theedgee isremovedfromTb andtwonodescorresponding
add
totheresulting blacktreesTb andTb aremadechildren ofr inH andarecoloredblack.
0 1 h
Then, an iterative procedure is performed to construct H. At the end of step i−1, edges of one color
c form a spanning forest Fc = {T0c,...,Tlc} of G = {C0,...,Cl}, where Ci are connected subgraphs of
G, and each element Tc of Fc is a spanning tree of its connected subgraph C . When restricted to these
i i
subgraphs, edges of the other color c form a set Fc = {{Tc ,...,Tc },...,{Tc ,...,Tc }}. Each
0,0 0,k0 l,0 l,kl
element Fc of Fc is a forest spanning its respective connected subgraph C . The trees Tc are ”linked”
i i i,j
together in G only with edges of color c. There are l + 1 vertices of color c at the last level of H, each
corresponding toatreefromFc. Atthebeginningofthei-thstep,alledgesofcolorccrossingthemulti-cut
defined byFc are found and deleted from G. Atthis point, G consists ofPl |Fc|connected subgraphs,
i=0 i
and the trees Tc of color c are the spanning trees of their respective subgraphs. For each vertex v of H
i,j h
corresponding toatreeTcfromFc,k +1verticesofcolorccorresponding tothetreesfromFc arecreated
i i i
2
j k q
a i l p
b h g m
eadd
c d e f n o
Figure1: AgraphG∗ = G∪{e }.
add
c d
a i h b l g e f p o n m q k
e b a i l q k j h g f n m o p c d
e b a i j l q k h g f p o n m c d
b a i j l q k h g f n m o p
a i j q k n m p o
m o p
o p
Figure2: H attheendofstepi= 8thatcompletes thedecomposition ofG∗.
inH aschildrenofv . Acrossedgeisaddedbetweentwoverticesx andy atthisnowlowestlevelifthe
h h h
corresponding treesTc andTc werepreviously inthesameconnected component andgotseparated atstep
x y
i−1byremovinganedgeofcolorcbetweenthem. AdditionofcrossedgestoH completesthei-thstepof
thedecomposition.
Atstepi+1,theseactionsarerepeated fortheswapped colors. Whenatsomestepj acutofcolorcis
tobefoundandsomeconnectedcomponentC doesnothavesuchcut,avertexl corresponding toatreeof
h
colorcthatspansC iscreatedinH andthedecomposition stopsforC. Thedecomposition ofGendswhen
ithasendedforallconnected components.
Theresulting graph H characterizing thedecomposition ofthegraph inFigure 1isshowninFigure 2.
Theentiredecomposition processisgiveninappendix duetolackofspace.
After H is constructed, a check of whether H satisfies the definition of the RBH is performed. If the
answer ispositive, H is aRBHand the corresponding graph Gis aLamangraph. Themethod in[1]takes
3
2
O(n )timetoconstruct thedecomposition-characterizing graph H and O(n)timetoverify thatitsatisfies
thedefinitionoftheRBH.
3 A sufficient condition
Weshow that if all edges are removed from Gduring the decomposition process, the graph H constructed
fromthedecomposition isalwaysaRBHandthusGisaLamangraph.
Vertices of H correspond to spanning trees of connected subgraphs of G. Anything marked by the
subscripthinwhatfollowsreferstoH. C(v )denotestheconnectedsubgraphofvertexv . V(v )denotes
h h h
the set of vertices of C(v ). T(v ) denotes a tree spanning V(v ). V(T) denotes the set of vertices of G
h h h
spanned bythetreeT.
WefirstprovethatthefourRBHrulesintroducedearlieralwaysholdforthedecomposition-characterizing
graph H ofanygraphG∗ = G∪e ,iftheedge setofG∗ canbepartitioned into twoedge-disjoint span-
add
ning trees. Let color(v ) denote the color associated with node v (red or black). If c = color(v ) is red
h h h
thencisblackandviceversa.
Rootrule. Attheveryfirststep,H isemptyandanoder ofcolorc,corresponding tothespanningtree
h
Tc that does not contain the added edge e , iscreated in H. Thenode r is the root of H. Then, e is
add h add
deleted fromthe othertree T ,whichnecessarily creates exactly twotrees ofcolor cinG∗ andexactly two
c
nodes of color c in H that are children of r , corresponding to these two trees. Thus, the root rule always
h
holds.
Leaf rule. We first prove that if a vertex v is the only child of its parent then v is a leaf. If a vertex
h h
v is the only child of its parent, the connected subgraph C(parent(v )) could not be split any further
h h
during decomposition and V(v ) = V(parent(v )). At the step when v was created, the decomposition
h h h
process has stopped for C(v ): there was just one tree of color color(v ) in C(parent(v )) and just one
h h h
tree of color color(v ) (otherwise C(parent(v )) would have been partitioned further and v would have
h h h
siblings). Hence,thevertexv corresponding toC(v )isaleafinH.
h h
Next, we prove that a leaf vertex cannot have any siblings. Suppose there is a vertex y having k > 1
h
childrenandatleastoneofthemisaleaf. Thevertexy corresponds toaconnectedsubgraph spannedbya
h
treeofcolor c = color(y )andaspanning forest ofk trees ofcolor c. Eachofits children xi corresponds
h h
to a connected subgraph C , i = 1,2,...,k, spanned by a tree of color c and a forest of color c (possibly
i
containing only one tree). If this spanning forest contains more than one tree, there are edges of color c in
C connecting the trees of the spanning forest. At the next step of the decomposition these edges will be
i
deleted, the spanning tree of color c will split into at least two different trees and corresponding vertices
will be created in H as children of xi. Hence, xi cannot be a leaf vertex. If the spanning forest of C(xi)
h h h
containsjustonetreethenavertexcorresponding tothattree,ofcolorc,iscreatedinH asachildofxi and
h
again, xi cannot be a leaf vertex. This argument holds for every child of y , contradicting the assumption
h h
thatatleastonechildofy isaleaf.
h
Cross-edgerule. Acrossedgeisaddedbetweenanytwoverticesu andv atstepiiftheircorrespond-
h h
ingvertexsetsV(u )andV(v )previously belonged tooneconnected subgraph C andgotseparated at
h h u,v
stepi−1byremovingtheedgebetweenthem. Atleveli−2ofH thereisalwaysavertexthatcorresponds
toC . Thevertices atthe samelevelofH correspond toconnected subgraphs that aredisjoint subgraphs
u,v
ofG. Hence,noothervertexatleveli−2ofH cancorrespond toaconnectedsubgraph containingV(u ),
h
V(v ),theirsubsets,ortheunionoftheirsubsets. ThevertexcorrespondingtotheconnectedsubgraphC
h u,v
isacommongrandparent ofu andv .
h h
4
Again,according totheconstruction rules,parentsofu andv inH correspond todifferentconnected
h h
subgraphs, sou andv havedifferentparents.
h h
Tree rule. If k edges are removed from the tree T spanning the vertex set V(v ) corresponding to
h
some vertex v of H, k +1 new trees result from T and k +1 nodes are created as grandchildren of v
h h
in H. For each edge e deleted from T, a cross edge is added between the vertices corresponding to the
two sub-trees of T that were connected by e. Each grandchild of v gets across edge incident to it. There
h
are k +1 grandchildren of v and k edges connecting them. The cross edges form a tree spanning all the
h
grandchildren ofv .
h
Wehaveshownthatred-blackhierarchyrulesholdforanyH. Then,weonlyneedtocheckifH satisfies
thegeneraldefinitionofahierarchy.
Lemma 3.1. If all edges are removed from G during the decomposition process then the characterizing
graphH ofGsatisfies thedefinition ofhierarchy.
Proof. TheedgesofH aretheunionoftheedgesoftherootedtreeT andthecrossedges. Thereisacross
h
edge e = (u ,v ) in H for each edge e = (u,v) of G: The edge e is deleted from Gwhen it crosses the
h h h
cutseparating ufromv;according totheconstruction rules,acrossedgeisthenaddedbetweenthevertices
ofH corresponding totheconnected components ofuandv atthecurrentstep.
There is one-to-one correspondence between the leaves of T and the vertices of G: Since the graph
h
splitting procedure continues until all edges are removed, each vertex v of G is eventually disconnected
from therestofthegraph bydeleting anedge ofsomecolor c. Avertex l corresponding toatreeofcolor
h
c spanning the connected subgraph C = {v} is then created in H. Since C cannot be split further, the
v v
decomposition stopsforC andl becomesaleafvertexofT . Also,thereisnoleafvertexinH thatdoes
v h h
not correspond to a vertex of G. Suppose there exists such a vertex in H. Then, it corresponds to a tree
spanningaconnectedsubgraphC ,with|C |> 1. ThismeansthatC containsedgesthatwerenotdeleted
x x x
duringthedecomposition ofG,acontradiction.
The endpoints of e are ancestors of α(u) and α(v), respectively, but they are not their common an-
h
cestors: recall that α(u) and α(v) are the leaf vertices of H corresponding to vertices u and v of G. The
vertex u corresponds tosome connected component C(u ). Thevertices ofH that aredescendants ofu
h h h
correspond to connected components over the subsets of V(u ). Theleaf vertices of H that correspond to
h
vertices in V(u ) are the descendants of u in H. Since u ∈ V(u ), u isan ancestor of α(u). Similarly,
h h h h
v is an ancestor of α(v). The vertices u and v are connected by a cross edge corresponding to two dis-
h h h
joint connected subgraphs. Therefore, u cannot be an ancestor ofα(v), and the end vertices of e are not
h h
commonancestors ofα(u)andα(v). 2
Lemma3.2. IfGhas edges left at the end ofthe decomposition process, thecharacterizing graph H of G
doesnotsatisfythedefinition ofhierarchy.
Proof. If there are non-deleted edges of G when the decomposition stops, then there are no corresponding
edges for them in H. In addition, we do not have a one-to-one map from V to L(T ): some leaves of T
h h
correspond toconnected subgraphs containing severalvertices. 2
Thus, building H is not required for certifying Laman graphs: just decompose G based on the rules
in[1]andcheckifGhasedgesleftwhenthedecomposition ends.
5
4 The decomposition algorithm
We have shown that building H is not required for verifying that G is a Laman graphs. It is sufficient to
performthedecomposition ofGaccordingtotherulesfrom[1]andthencheckwhetherthereareedgesleft
in G. The decomposition algorithm has some notable features. At each step edges of only one color are
deleted. The groups of red and black edges are deleted in turns. At each step, except the first and the last
ones, at least one edge is deleted from G (some edges may never be deleted). Thus, the edges of G can
be grouped so that edges of one group are deleted from G at the same step. The decomposition process
providesanaturalorderonthesegroups. Wedenotethisorderingasg = (g2,g3,...,gk),wheretheindexi
ofg corresponds tothestepatwhichtheedgesofthegroupg aredeleted.
i i
Instead of H, weuse g to characterize the graph decomposition. Our maingoal now istospeed up the
decomposition algorithm from [1]using the following simple observation: deletion ofany edge e = (u,v)
from its tree (of color color(e)), where u is a parent of v in a DFS ordering of the tree of color color(e),
alwaysformstwotreessuchthatoneofthemisrootedatv andallnodesinthattreearedescendants ofv.
Weslightlymodifythegraphdecompositionalgorithmfrom[1]. Theedgestobedeletedatthenextstep
are identified atthe end of the preceding step and marked for deletion. Atthe first step, e is marked for
add
deletion(andnootheractionisperformed). EachiterativestepinGconsistsofremovingthemarkededges
ofsomecolor cand identifying and marking the edges crossing thecuts ofthe opposite color cthat appear
afterremovingthemarkededges. Wealsonotethatoncetheoriginal graphhassplitintoseveralconnected
subgraphs, the decomposition proceeds independently on each subgraph, and the problem of finding the
edges to be deleted at the subsequent step can be viewed as several independent subproblems, each on a
distinctconnected subgraph.
Consider the graph G∗ and its two edge disjoint spanning trees Tc and Tc, rooted at vertices rc and
rc, respectively. Let DFS(c) be the depth-first search traversal of G∗ starting at rc and using only edges
of color c, where c is either red or black. We assign each vertex of G two DFS order numbers, one from
DFS(red) and another one from DFS(black). New edges are never added to the trees, so the numbers
never change. For any edge of color c, it is always possible to establish the parent-child relationship of its
endpoints by looking at their DFS numbers for color c. Whenever an edge e is mentioned in this text as a
vertexpair,thefirstvertexisalwaystheparentofthesecondvertexinDFS(color(e)).
Whenanedgee= (u,v)ofcolorcisdeletedfromatreeTcrootedatsomercandspanningaconnected
k
subgraph C ,twotreesemerge: Tc rootedatrc andTc rootedatv. OnlytheverticesofTc aredescendants
k i j j
of v in DFS(c). The ancestor/descendant relationship can be established in the DFS(c) tree by looking at
thediscoveryandfinishtimes(dc[·]andfc[·],respectively) ofthevertices.
Lemma4.1. Anedge (x,y) of color c crosses the cut (V(Tc),V(Tc)) induced by the deletion ofthe edge
i j
(u,v)ofcolorcifandonlyifoneofitsendpoints isadescendant ofv andtheotheroneisnot,i.e.,exactly
oneofitsendpoints discovery timesisint = [dc[v],fc[v]].
Proof. If dc[x] 6∈ t and dc[y] ∈ t, then x ∈ Tc and y ∈ Tc, so e clearly crosses the cut. A symmetric
i j
argumentapplies ifdc[x] ∈ tanddc[y] 6∈ t.
Ifdc[x] 6∈ tanddc[y] 6∈ t,neitherxnoryareinTc,sobothendpointsofeareinTc andedoesnotcross
j i
thecut. Ifdc[x] ∈ tanddc[y] ∈ t,bothendpoints ofeareinTc andedoesnotcrossthecut. 2
j
From Lemma4.1itfollowsthat ifweassociate aninterval [dc[u],dc[v]] withevery edge ofcolor c, the
intervals corresponding totheedgescrossing thecuthaveexactlyoneendpoint int.
We identify such intervals using a segment tree data structure enhanced with two lists at each internal
6
node, one sorted by the start time of the intervals stored at the node and one sorted by their finish time. A
segmenttree[9]isabalancedbinarysearchtreethatstoresasetofintervalswithendpointsfromafiniteset
of abscissae (intervals corresponding to edges of color c, for example). Each of its nodes uhas an interval
I(u)associated withitandstoresalistofinput intervals intersecting I(u). Binarysearchinasegmenttree
allowstoreporttheintervalscontaining aquerypoint.
Inourcase, theendpoints oftheintervals are integer numbers, soaninterval containing apoint p±∆,
forany0 < ∆ < 1, contains thepoint paswell. First, wefindtheintervals withoneendpoint before dc[v]
and the other endpoint in t by querying for intervals containing the point dc[v]−∆. Second, we find the
intervals with one endpoint in t and the other endpoint after fc[v] by querying for intervals containing the
pointfc[v]+∆.
To ensure that each returned interval has an endpoint in t we augment the standard segment tree by
storing two sorted lists at each node, instead of just one list. With each node u, we store a list L (u)
finish
of intervals that intersect I(u) that is sorted by the finish time of the intervals in non-decreasing order;
similarly, the list L stores the same intervals sorted by their starting time in non-increasing order. We
start
give both queries above an additional parameter: fc[v] for the first one and dc[v] for the second one. The
first query only looks at the lists L and reports the intervals that have their right endpoint no greater
finish
than fc[v]. The second query only looks at the lists L and reports the intervals that have their starting
start
point nolaterthan dc[v]. Thus, thisdatastructure allowsustoreturn intervals withexactly oneendpoint in
t. Eachquerywithanedge(intervalt)takesO(logn+k)time,wherekisthenumberofintervals(crossing
edges)reported. Toavoidreportinganintervalmorethanonce,theintervalisdeletedfromthesegmenttree
(including the sorted lists associated with the nodes that store it) when it is returned by a query. This can
be easily done in O(logn) time. Having two segment trees, one for the red intervals [dred[u],dred[v]] of
the black edges and the another one for the black intervals [dblack[u],dblack[v]] of the red edges, allows to
efficientlyidentify edgesofthecutsateachstepofthedecomposition.
Lemma4.2. Thedecomposition ofGcanbedoneinO(nlogn)time.
Theorem 4.3. GivenagraphGwithnvertices andmedges deciding whether GisaLamangraph ornot
can be done in O(T (n)+ nlogn) time, where T (n) is the time to extract two edge disjoint spanning
st st
treesfromGordecidenosuchtreesexist.
Proof. Wecancheck that m = 2n−3inO(n)time. Finding twoedge disjoint spanning trees ordeciding
no such trees exist takes T (n)time. The best known algorithm so far for this task has T (n) = O(n3/2)
st st
time[2]. Thedecomposition takesO(nlogn)time: O(nlogn)forthesegmenttrees,O(nlogn)toanswer
allqueries, andO(n)tocheckifGhasanyedgesleftattheendofthedecomposition. 2
5 The reconstruction algorithm
The order in which edges are deleted from G during the decomposition determines the structure of the
corresponding red-black hierarchy H,sogiveng,onecanunambiguously construct H intop-downfashion
according to the rules from [1]. The vertices of H correspond to subtrees of Tc and Tc, and there is a
vertex in H for each distinct sub-tree (of Tc or Tc) that appeared during the decomposition of G. In the
original approach, to construct the i-th level of H, one has to know the spanning sub-trees at step i−2 of
the decomposition and to figure out what trees appear after removal of edges at the beginning of step i. It
takesO(n)timetofindtheemerging trees.
Weconsider the decomposition process inreverse order (i.e. startfrom nredand nblack disjoint trees
and add edges to them until two spanning trees are formed), and take advantage of the fact that it is faster
7
p o
o p
o p
Figure3: H afterconsidering edgesofg8 = {(o,p)}.
m o p
m p o
m o p
o p
Figure4: H afterconsidering edgesofg8 andg7 = {(m,o),(m,p)}.
to union the disjoint sets into larger sets than to partition the trees into disjoint sub-trees. As a result, the
proposedbottom-upconstructionmethodisfasterandproducesthesamegraphH asthetop-downapproach.
The last group gk of g = (g2,g3,...,gk) contains edges of some color c deleted at the very last step
of the decomposition. Each endpoint v of edges of g corresponds to a subtree of G of color c spanning
k
only the vertex v. A leaf node v = α(v) is added to the k-th level of H for each such vertex v. Only
h
one leaf vertex is created for the endpoint shared by multiple edges from g . For every edge (u,v) of g a
k k
corresponding crossedgeβ(u,v) = (α(u),α(v)) isaddedtoH. Foreveryleafvertexα(v)ofH,itsparent
shouldbeatlevelk−1ofH,corresponding toasubtreeinGthatisofcolorcandspansonlythevertexv.
Such parent vertex vp = parent(α(v)) is added to level k−1 of H along with a tree edge connecting vp
h h
andα(v)(wecallthistheparentcreationrule). TheverticesofH connected byacrossedgehavethesame
grandparent. ForeverycrossedgetreeTj formedatthek-thlevel,avertexvg isaddedtolevelk−2ofH,
k h
aswellasatreeedgeconnecting vg andvp,foreveryv ∈ Tj. Wehavecompleted levelk ofH aswellas
h h h k
addedsomeelementstothetwoupperlevels. SeeFigure3andFigure4foranillustration.
At the i-th iterative step for each cross edge (x,y) of g of color c two vertices vx and vy on the i-th
i h h
levelofH areidentified. Theycorrespond totreesinGofcolorcthatcontained xandy respectively atthe
i-thstepofthedecomposition. Ifforsomeendpoint xofanedgefromg vx doesnotexistonthei-thlevel
i h
of H, a new vertex vx should be created at the i-th level and a parent for it should be added following the
h
parent creation rule. Then the cross edge corresponding to (x,y) is added to H between vx and vy. After
h h
all edges of g are considered, all cross-edges of the i-th level of H are in place. For each cross edge tree
i
Tj formed at the i-th level of H, a node is added to level i−2 of H. That grandparent node becomes a
i
parentoftheparentsoftheverticesofH spannedbythecross-edge treeTj. Atthistimethei-thlevelofH
i
iscompleteandlevelsi−1andi−2ofH arepartiallyconstructed. Repeatingthesestepsforallg ,i > 2,
i
yieldstheRBHH.
8
j k q
a i l p
b h g m
eadd
c d f n o
Figure5: G\{e}.
Lemma5.1. Giventwoedge-disjoint spanning treesforG∗,ared-blackhierarchyforG,ifitexists, canbe
constructed inO(nlogn)time.
Proof. Obtaining g forG∗ takes O(nlogn)time(Lemma4.3). Thetimespent onreconstructing one level
isproportional tothenumber ofcross edges atthat level. Thetotal numberofcrossedges isO(n). Weuse
astandard UNION-FINDdatastructure formaintaining thevertices ofGthattheverticesofH correspond
to at each step (notice that the actual trees of color c or c defined by those vertices in G are not needed to
construct H). This allows to complete the reconstruction phase in O(nlogn) time, so the total time for
constructing theRBHisO(nlogn).
2
6 RBH and Henneberg construction
In this section we point out some difficulties in using red-black hierarchies to compute a Henneberg con-
struction for G, which seem to imply super-quadratic time algorithms when red-black hierarchies are used
forembeddingaplanarLamangraphasapointedpseudo-triangulation.
Thevertex eofthegraphinFigure1fallsincase4a)from [1]: thegrandparent oftheleafvertexα(e)
has more than two children, α(e) has two incident cross edges and its immediate parent has one incident
cross edge (see Figure 2). During the Henneberg construction we need to remove vertex e from G along
withitsincidentedges(e,g),(e,f),and(e,d),andinsertanedgebetweentwooftheverticesg,f,anddto
restoretheLamanpropertyofthemodifiedgraph. NotethatGalreadyhasedges(g,d)and(g,f),andthus
addingtheedgebetweendandf istheonlyoption.
Having removed efrom H, weneed to restore the properties of the hierarchy as if ewas never present
in the original graph. This does not appear to be an easy task, since the red-black hierarchy for the graph
G\{e} (Figure 5) differs significantly from the one for G (Figure 6). Thus, it seems one would need to
recompute the RBH for the resulting graph (starting with finding two edge disjoint spanning trees), which
wouldtakeO(T (n)+nlogn)timeratherthanO(n)timein[1]. Essentially,obtainingthenewRBHfrom
st
the old one would be as difficult as obtaining two edge disjoint spanning trees for the new graph from the
edgedisjoint spanning treesoftheoriginalgraph.
The argument above implies that, over O(n) steps, the Henneberg decomposition would take time
O(n(T (n)+nlogn)). Accordingly, embedding aplanar Lamangraph asapointed pseudo-triangulation
st
using red-black hierarchies would require O(n2.5) time using the best known algorithm for finding two
edge-disjoint spanning trees, whichgivesT (n)= O(n1.5)[2].
st
9