HAL Id: inria-00536803
https://hal.inria.fr/inria-00536803
Submitted on 16 Nov 2010
HAL is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.
An Efficient Algorithm for the Configuration Problem of Dominance Graphs
Ernst Althaus, Denys Duchier, Alexander Koller, Kurt Mehlhorn, Joachim Niehren, Sven Thiel
To cite this version:
Ernst Althaus, Denys Duchier, Alexander Koller, Kurt Mehlhorn, Joachim Niehren, et al.. An Efficient
Algorithm for the Configuration Problem of Dominance Graphs. Proceedings of the 12th ACM-
SIAM Symposium on Discrete Algorithms, 2001, Washington, DC, United States. pp.815–824. �inria-
00536803�
of Dominane Graphs 1
Ernst Althaus 2
Denys Duhier 3
Alexander Koller 4
Kurt Mehlhorn 2
JoahimNiehren 3
Sven Thiel 2
Abstrat
Dominaneonstraintsarelogialtreedesriptionsoriginat-
ingfromautomatatheorythathavemultipleappliationsin
omputationallinguistis. Thesatisabilityproblemofdom-
inane onstraints is NP-omplete. In most appliations,
however, onlynormal dominaneonstraintsareused. The
satisability problem of normaldominane onstraints an
be redued in linear time to the onguration problem of
dominanegraphs,asshownreently.Inthispaper,wegive
apolynomialtimealgorithmtestingongurabilityofdom-
inanegraphs (andthus satisability of normaldominane
onstraints). Previoustoourworknopolynomialtimealgo-
rithmswereknown.
1 Introdution
Thedominanerelationofatreeistheanestorrelation
between its nodes. Dominane onstraints are logial
desriptionsof treestalkingaboutthedominane rela-
tion. Dominanebasedtreedesriptionswererstused
inautomatatheoryinthesixties[TW67℄andredisov-
ered in omputational linguistis in the early eighties
[MHF83℄. Sinethen,theyhavefoundnumerousappli-
ations: they have been used for grammar formalisms
[VS92, RVSW95℄, insemantis[Mus95,ENRX98℄, and
fordisourseanalysis [GW98℄.
Thesatisabilityproblemofdominaneonstraints
isNP-omplete[KNT98℄. Earlierattempts at proess-
ingdominaneonstraints[Cor94,VSWR95,DN00℄all
suerfromthisfat. Butitturnsoutthatnormaldom-
inaneonstraints, a restrited sublanguage, are suÆ-
ient for most appliations. The starting point of the
graphbasedapproahofthispaperisanotherreentre-
sult[KMN00℄showingthatthesatisabilityproblemof
normaldominaneonstraintsanbereduedinlinear
timetotheongurationproblemofdominanegraphs.
Informally,adominane graph isgivenbyaolle-
tionof rootedtreesand aset ofdominanewishes. (A
1
PartiallysupportedbytheISTProgrammeoftheEUunder
ontratnumberIST-1999-14186(ALCOM-FT)
2
Max-Plank-Institute for Computer Siene, Saarbruken,
Germany
3
ProgrammingSystemsLab,FahbereihInformatik,Univer-
sitatdesSaarlandes,Saarbruken,Germany
4
Department of Computational Linguistis, Universitat des
Saarlandes,Saarbruken,Germany
preise denition follows in Setion 2.) A dominane
wish is a direted edge from the leaf of some tree to
therootofsomeothertree. A onguration ofadomi-
nanegraphisobtainedbyassemblingthetreesof the
graphinto a forest, by hooking roots into leaves suh
thatalldominanewishesaretranslatedinto anestor-
desendantrelationships. Theongurationproblem of
dominane graphs is thequestionwhether there exists
aongurationforagivendominanegraph.
Inthispaper,weshowthattheongurationprob-
lem of dominanegraphs is in polynomial time. This
resultimmediatelyleadsthewayforapolynomialtime
andpratiallymoreeÆientproessingofnormaldom-
inaneonstraintsin omputationallinguistis.
Togetanideaofhowongurationsofdominane
graphsariseinlinguistis,onsiderthe[ENRX98℄anal-
ysisofthefollowingEnglishsentene:
(1.1) Everylinguistspeakstwolanguages.
a. ...,namelyEnglishandGerman.
b. ...,notneessarilythesameones.
Depending on theontext (indiatedby the ontinua-
tionsa. and b.), this sentene anberead in twodif-
ferentways{itexhibitsasopeambiguity. Itanmean
eitherthatthereisasetoftwolanguagesspokenbyev-
erylinguist, oritanmeanthat eah linguistanpik
hisownpairoflanguages.
Thisambiguityanberepresentedompatlybythe
graphin Figure 1, whih wean read asa dominane
graph by removing the node labels. Intuitively, the
ontributions of \every linguist" and \two languages"
to the meaning of the sentene are represented as
the two upper trees; the ontribution of \speaks" is
representedas the lower one. The tree ongurations
of this dominane graphare obtainedby plugging the
twouppertreesinsomeorderontoponthelowertree.
The two waysto arrangethem orrespond to the two
dierentreadingsof(1.1).
Our paperisorganizedasfollows. InSetion 2we
denethetermsdominanegraph,solvedform,andon-
every ling
x
two
speak y
x lang
y
Figure1: Dominanegraphforasopeambiguity.
the sueedingsetions. InSetion 3, weshowhowto
enumerate all ongurations of a dominane graph in
exponentialtime;thisprovidesaframeworkfortheap-
pliationofthelaterresults. InSetion4,weharater-
ize ongurabledominanegraphs(adominanegraph
hasaongurationiitontainsnohypernormalyle),
and then weshowin Setion 5howthe existene of a
hypernormalyleanbedeidedbysolvingaweighted
mathing problemin anauxiliarygraph. Thisgivesus
apolynomial-timeongurabilitytest whih weuse in
Setion6tomaketheenumerationalgorithmfromSe-
tion3eÆient. Setion 7showsthat aslightextension
of the ongurationproblem by losed leaves is again
NP-omplete. Finally,weoerashort onlusion.
2 Denitions
Adominanegraph isdenedbyadiretedgraphG=
(V;E _
[D) satisfyingthe followingtwoonditions: (1)
the graph G = (V;E) denes 5
a olletion T of node
disjointtrees of height at least 1and (2) eah edge in
D goesfromaleafofsometreein theolletiontothe
root of some tree in the olletion. In our gures, we
drawthe edgesin E solid and the edgesin D dashed.
WealltheedgesinE solidedges ortreeedges andwe
alltheedgesin Ddashededges ordominaneedges or
dominane wishes. A leaf is a node with no outgoing
tree edge and a root is a node with no inoming tree
edge.
Nowtheideaisthatwewanttoassemblethetrees
in T by plugging roots into leaves. We say that a
dominane graphG is in solved form i it is a forest.
If G = (V;E _
[D) is a dominane graph, we all a
dominane graph G 0
= (V 0
;E 0
_
[D 0
) a solved form of
G i V = V 0
, E = E 0
, G 0
is in solved form, and G 0
realizesall dominane wishesin G {that is, for every
dominanewish(v;w)2D thereisapathfromv tow
in G 0
.
Inpartiular,weall asolvedformofGwherethe
dominaneedgesinD 0
areamathingaongurationof
5
G. Rootshaveatmostoneinomingdominaneedgein
ongurations;theintuitionisthattherootshavebeen
\plugged"intotheleaves,andtheremainingdominane
edgesindiate whihrootispluggedintowhihleaves.
A dominane graphis ongurable ifit has aon-
gurationandsolvable ifithasasolvedform. Figure2
showsaongurablegraphandoneonguration. Fig-
ure3displaysanunongurablegraph,theheavyedges
indiatean\unongurableyle",asweshallseelater.
1
3 4
2
1 2
3 4
Figure 2: A ongurable dominanegraphand aon-
gurationofit.
Figure 3: An unongurable dominane graph; the
l l
0
r
t t
0
z
1
zk l
0
r
l t t
0
z1
z
k
Figure4: AppliationofRule1: All dominanewishes
ofl 0
exeptfor(l 0
;r)areshifteddowntotheleafl.
Theproblemweinvestigateinthispaperistodeide
whether agiven dominanegraphhas aonguration.
Morepreisely,wearegoingtoonsidertheproblemof
whetherit hasasolvedform; butthe followinglemma
expressesthat thisisthesameproblem.
Lemma2.1. Every dominane graph in solved form is
ongurable.
Conversely, every ongurable graph is trivially solv-
able.
Proof. For the proof, we dene a problem leaf to be
a leaf with more than one outgoing dominane edge;
ouraimwillbetoeliminateproblemleavesfromsolved
forms.
Theproofisbyindutiononweights(d;a)ofgraphs
G,wheredisthenegativeminimumdepthofaproblem
leafofG(or 1iftherearen'tany),andaisthetotal
number of dominane edges emanating from problem
leavesof minimum depth (potentially0). Weonsider
thelexiographiorderonthese weights.
Solved forms without problem leaves (i.e. with
weight ( 1;0)) are ongurations, so the lemma is
trivially true in this ase. So let G be a solved form
thatdoeshaveproblemleaves.LetGhaveweight(d;a),
andassumethatweknowthatallsolvedformsoflower
weightdo haveongurations. Then weanapply the
followingruletoaproblemleafl 0
ofminimumdepth:
Simplifiation Rule1. Let e = (l 0
;r) be a domi-
nane edge from the leaf l 0
of a tree t 0
to the root r
of atreet. Letl be an arbitrary leaf of t. Change any
dominane edge (l 0
;z) with z 6= r into (l;z), see Fig-
ure4.
TheresultG 0
isstill insolvedform,anditsweight
hypothesis, G has a onguration G
. But G
also
realizesall dominanewishesofG. This isobviousfor
(l 0
;r)and forallwisheswhih donotstartin l 0
. Fora
wish(l 0
;z)withz6=rwenotethatthiswishisrealized
beausethereisapathfroml 0
tolinG 0
andG
realizes
thewish(l;z). SoGhasaongurationaswell. ut
Finally, we all a dominane wish d = (v;w)
redundant if there is a path from v to w in Gnd.
A dominane graph is alled redued if it ontains no
redundantdominanewish. Asusual, weusenand m,
respetively, to denote thenumber ofnodes and edges
ofG.
Inthefollowingsetionsweshow:
Congurabilityofadominanegraphhasasimple
haraterization.
Congurability of a dominane graph an be de-
idedinpolynomialtime. Morepreisely,itanbe
deided by solving a weighted mathing problem
in an auxiliary graphwith n 0
= O(m) nodes and
m 0
= P
v2V indeg
2
v
edges;hereindeg
v
isthedegree
ofvin G. Themathingproblemanbesolvedin
timeO(n 0
m 0
logn 0
),see[GMG86℄.
Asolvedformofa(ongurable)dominanegraph
an be onstruted in polynomial time. More
preisely,itanbefoundin timeO(n 2
n 0
m 0
logn 0
).
All solved forms of a dominane graph an be
enumeratedin polynomial time per onguration.
Morepreisely,ifN denotes thenumberof solved
formsthenallongurationsanbeenumeratedin
time O((N +1)T), where T is the time to nd a
singleone.
OurtheoretialresultsleadtoapratiallyeÆient
algorithmforhandlingdominanegraphs. Theal-
gorithmhasbeenimplemented. Inourappliation,
wehavem=O(n),and P
v2V indeg
2
v
=O(n). The
existaneofaongurationanthereforebetested
in time T = O(n 2
logn), and a solved form an
be onstruted in time O(n 2
T). The atual run-
ning times are smaller sine the arising weighted
mathingproblemsseemtobefairlysimpleandthe
number of mathing problems to be solved seems
tobemuhlessthann 2
. Ourimplementationuses
LEDA [MNSU ,MN99℄ and themathing odes of
T.ZieglerandG.Shafer[Zie95,Sh00℄.
3 Enumerationof Solved Forms
Inthis setion, we show howto enumerate the solved
forms of a dominane graph G. The algorithm we
present may take exponential time to produe even a
ases. In Setion 5, we will present a polynomial al-
gorithm for determining ongurability. By plugging
this algorithm intothe enumerationalgorithm,wean
enumerate ongurations in polynomial time per on-
guration(Setion6).
The enumeration algorithm applies the following
simpliationrules:
Simplifiation Rule 2. (Redundany Elim.) All
redundantdominaneedges,i.e. edges that are implied
by transitivity, an be removed. In partiular, parallel
edges an beombinedintoone.
Simplifiation Rule 3. (Choie) Let v be a root
with atleasttwo inomingdominane wishes (l;v) and
(l 0
;v)andletrandr 0
betherootsofthetreesontaining
leaves l and l 0
, respetively. Generate two new graphs
H and H 0
by adding either (l 0
;r) or (l;r 0
) to D, see
Figure5.
Theenumerationofthesolvedformsanbearried
outbyareursivealgorithm:
1. Makethegraphredued,i.e. applyRule2.
2. Ifthegraphontainsa(direted) yle,terminate
thisreursionsinethegraphhasnoonguration.
3. If the graph is in solved form, report it and
terminatethisreursion.
4. Otherwise, apply the hoie rule and apply the
algorithmtothetwonewlygeneratedgraphs.
Every solved form derived by the algorithm is
learly a solved form of the original graph. On the
other hand, thealgorithm enumeratesall of itssolved
forms. This is beause appliation of Rule 2 to a
dominane graph does not hange the set of solved
forms. Appliation of Rule 3 partitions the set: The
twonewgraphshavedisjointsets of solved forms,but
the union of these sets is the same as the old set of
solved forms. This anbe seenasfollows. Inasolved
formG
s
ofGthenodeslandl 0
arebothanestorsofv
andthereforeeitherl 0
isanestoroflandheneofror
vieversa. Thisimpliesthat G
s
iseitherasolvedform
ofH orofH 0
.
To prove termination, we derive an upper bound
for the maximum reursion depth. Consider for any
dominanegraphGitsreahabilityrelationR
G
{theset
ofallpairs(u;v)ofnodessuhthatthereisa(direted)
path from uto v in G. If G isayli, theardinality
of R
G
is at most n
2
n 2
. Thus, whenever the size
ofthe relationbeomesgreaterthan n
2
,thereursion
relationinreasesstritly, i.e. jR
G
j<min(jR
H j;jR
H 0j).
This is beauseR
H
R
G
, and (l 0
;r) 2R
H but (l
0
;r)
annot be in R
G
, otherwise (l 0
;v) would have been
redundant. AsimilarargumentholdsforH 0
.
4 A Graph-Theoreti Charaterization of
Solvability
Wegiveagraphtheoretiharaterizationofsolvability;
asthisisequivalenttoongurabilitybyLemma2.1,the
resultarriesoverto ongurability. Theharateriza-
tionimpliesthatthesolvabilityproblemfordominane
graphsisin NP\o-NP.
Theundireteddominanegraph G
u
orresponding
tothedominanegraphG=(V;E _
[D)istheundireted
graphobtainedbymakingalledgesofGundireted.
Now, we want to dene the notion of a yle in an
undireted graph, whih may dier from the reader's
usual notion. A yle C in an undireted graph is a
sequene of edges e
0 Æe
1
Æ:::Æe
n 1
with n> 1 suh
that fori=0;:::;n 1thefollowingholds:
thereisanodev
i
inidenttobothe
i ande
(i+1)modn
e
i 6=e
(i+1)modn
We allC edge-simple iftheedges in thesequeneare
pairwisedierent. Cissaidtobesimpleifallthevisited
nodesv
0
;:::;v
n 1
arepairwisedierent.
4.1 HypernormalDominane Graphs
Let us rst investigate a simpler subproblem of the
solvabilityproblem. AdominanegraphG=(V;E _
[D)
is hypernormal if for every leaf l in (V;E) there is at
most one dominane wish (l;:) in D. Hypernormal
dominanegraphsareredued 6
.
Proposition4.1. Let G=(V;E _
[D)bea hypernor-
maldominanegraph. IfG
u
ontainsaylethenGis
unsolvable.
Proof. Theproofisbyindutionontheminimalnumber
kofdominaneedgesinasimpleyleCofG
u
. Clearly,
theasek=0annotour,andifk=1thenGisnot
solvable. Ontheother hand,assumethatweknowthe
result to betrue for k 1. C either does not ontain
anynodesatwhihits edgeshangediretions; thenit
is alsoayle inG andhene,G islearlyunsolvable.
OrC doeshangediretions, thenitmustontaintwo
dominane edges (l;r) and (l 0
;r) into the same root.
Bothresultsofapplyingthehoieruleproduegraphs
6
Analternativedenitionofhypernormalgraphsisasfollows:
Out of two dominane wishes (l ;v) and (l ;v 0
) at least one is
redundant.
l l 0
v
l l
0 r
v
r r r
l l
0
r r
v
Figure5: Twographsare generatedbyapplyingthehoierule tothegraphonthelefthand side.
withasimpleyle ontainingk 1dominaneedges,
sobothareunsolvable. Butthen,Gmustbeunsolvable
aswell. ut
Theonverseof theaboveproposition isalso true.
If G is not solvable, then G
u
ontains a yle. This
statementwillbeaorollaryofTheorem4.1,whih we
willprovebelow.
4.2 DominaneGraphs
TheProposition4.1doesnotarryoverliterally tothe
general ase: Figure 6 is a ounterexample. In order
to state our theorem for the general ase, we all a
subgraph H
u of G
u
hypernormal if the orresponding
diretedsubgraphH ofGishypernormal.
Theorem4.1. Let G = (V;E _
[D) be a dominane
graph.
(a) GissolvableiG
u
doesnotontainahypernormal
yle.
(b) Gis solvable i every hypernormal subgraph of G
is.
NotethatthisimpliesthatagraphGisongurable
iG
u
hasnohypernormalyle,byLemma2.1.
Proof. Part (b) follows immediately from part (a). If
some hypernormal subgraph of G is unsolvable, G is
unsolvable. If every hypernormal subgraph of G is
solvable,G
u
ontainsnohypernormalyle, andhene
Gissolvablebypart(a). Weturnto part(a).
Assume rstthat G
u
ontainsahypernormalyle
C. LetD 0
bethedominaneedgesof Gorresponding
toedgesin C. ThenG 0
=(V;E _
[D 0
)isahypernormal
dominanegraphsuhthat G 0
u
ontainsC. ByPropo-
sition4.1,G 0
isunsolvableandheneGisunsolvable.
Itremainstoprovetheonverse: IfGisunsolvable,
G
u
ontainsasimplehypernormalyle. Assume that
the statement is false. W.l.o.g. we may restrit our
attention to redued dominane graphs. If the hoie
ruleisnotappliableto agraph,thisgraphiseitherin
solved form or hasa direted yle, so thetheorem is
truefortheseases. Hene,theremustbea\minimal"
ounterexample G to the statement, in the following
sense:
Gisreduedandunsolvable
G
u
doesnotontainahypernormalyle
Thehoierule anbeapplied toG. Bothgraphs
HandH 0
whiharegeneratedbyitareunsolvable,
and both H
u
and H 0
u
do ontain hypernormal
yles.
We will derive a ontradition by showing that this
impliesthat G
u
ontainsahypernormalyle.
Supposethatvistherootandthat(l;v)and(l 0
;v)
arethewishesonsideredintheaboveappliationofthe
hoierule. Letrbetherootofthetreewiththeleafl
andr 0
betherootofthetreewiththeleafl 0
.
Wehavea hypernormal yle C
1
= fl;r 0
gÆP
1 in H
u
andahypernormalyleC
2
=fl 0
;rgÆP
2 in H
0
u . Sine
C
1
ishypernormal,P
1
doesnotuseanydominaneedge
inidentto l. IfP
1
doesnotusesomedominane edge
fl 0
;wginidenttol 0
,wearedonesineG
u
ontainsthe
hypernormal yle fl;vgfv;l 0
gÆ(l 0
! r 0
)ÆP
1 , where
l 0
!r 0
isthetree-pathfroml 0
tor 0
. Soassumewean
deompose P
1
= Q
1 Æfl
0
;wgÆR
1
, then R
1
does not
use any dominane edge inident to lor l 0
. A similar
argumentgivesusadeompositionP
2
=Q
2
Æfl;ugÆR
2
suh that R
2
avoids all dominane edges inident to l
andl 0
.
ThuswehavetheyleC=fl 0
;wgÆR
1
Æfl;ugÆR
2 in
G
u
. This yleis notneessarilyhypernormalbut the
pathsfl 0
;wgÆR
1
Æfl;ugandfl;ugÆR
2 Æfl
0
;wgare.
The following lemma showsthat this suÆes to prove
thatG
u
ontainsahypernormalyle:
Lemma4.1. IfG
u
ontainsayleC=e
S ÆSÆe
T ÆT
where e ;e are edges and S;T are paths suh that
4 2
5 6
3
7 1
5
4 7
6 1 3 2
Figure6: A solvabledominanegraphand oneofitssolvedforms. Thegraphontainsanundireted yle,but
nohypernormalyle.
e
S ÆSÆe
T and e
T
ÆTÆe
S
are hypernormal, then G
u
ontainsahypernormal yle.
Beforeweprovethelemma, wewantto givesome
intuition ofitsstatement: Ifwean "glue"twohyper-
normalpaths(e
S
ÆSande
T
ÆT)togehtersuhthatthey
formaylewhihishypernormalatthe"glue"nodes,
thenG
u
ontainsahypernormalyle.
Proof. We may assume that C is the smallest yle
(i.e. withtheleastnumberofedges)inG
u
fulllingthe
onditionofthelemma. Weonsidertwoases:
C issimple:
SineeverynodeonC is aninnernodeof atleast
oneofthetwohypernormalpaths,wehavethatC
does not ontaina onseutivepair of dominane
edges inident to the same leaf. And hene, the
simpliityofC impliesthatC ishypernormal.
C isnotsimple:
By the hoie of C the paths P
1
= e
S
ÆS and
P
2
=e
T
ÆT aresimple. Wemayassumethat none
of the twois ayle, otherwiseweare done. Let
v bea node whih is visited twie byC. Then v
mustbeaninner nodeofbothP
1 andP
2
, andwe
andeomposethepathsatv: P
1
=e
S ÆS
0
ÆfÆS 00
andP
2
=e
T ÆT
0
ÆgÆT 00
. Here f andg areedges
andS 0
;S 00
;T 0
;T 00
are(possibly empty)pathssuh
that e
S ÆS
0
ande
T ÆT
0
end atv. Altogehter, we
havethefollowingdeomposition:
C=e
S ÆS
0
ÆfÆS 00
Æe
T ÆT
0
ÆgÆT 00
Wehavetodistinguishtwoases:
1. f isnotadominaneedge:
Then C 0
= e
T ÆT
0
Æf ÆS 00
is a yle and
e
T ÆT
0
Æf and f ÆS 00
Æe
T
are hypernormal
2. f isadominaneedge:
Thene
S ÆS
0
doesnotend with adominane
edge. HeneC 0
=e
S ÆS
0
ÆgÆT 00
isayleand
bothe
S ÆS
0
ÆgandgÆT 00
Æe
S
arehypernomal.
InbothasesC 0
issmaller thanC, andC 0
fullls
theonditionofthelemma,aontradition.
u t
The haraterization theorem has an interesting
onsequene. The solvability problem for dominane
graphsislearlyin NP. Non-solvabilityis tantamount
to the existane of a simple hypernormal yle, and
the existane of suh a yle is learly in NP. Thus
solvabilityisin NP\o-NP.
5 Testing for HypernormalCyles
Nowweshowhowtotestforthepreseneofhypernor-
mal yles in a dominane graph in polynomial time.
This immediately gives us apolynomial algorithm for
testingsolvability(andhene,ongurability)ofdomi-
nane graphs.
Thetest isbysolvingaweightedperfetmathing
problem on anauxiliarygraphA whih is onstruted
asfollows. Foreveryedge e=(v;w)2G wehavetwo
nodes e
v
= ((v;w);v) and e
w
= ((v;w);w) in A. We
alsohavethefollowingtwokindsofedges.
(Type A) Foreveryedgeewehavetheedgefe
v
;e
w g.
(Type B) Foreverynodevanddistintinidentedges
e=(u;v)andf =(v;w)wehavetheedgefe
v
;f
v g
ifeither visnotaleaforv isaleafandeithereor
f isatreeedge.
The type A edges form a perfet mathing in A. We
givetypeAedgesweightzeroandtypeBedgesweight
inginAispositiveiG
u
ontainsasimplehypernormal
yle.
Proof. Suppose rst that G
u
ontains a hypernormal
yleC. WemayassumethatCissimple. Weonstrut
amathingMofpositiveweight. Foranypaire=(u;v)
and f = (v;w) of onseutive edges in C, we put
fe
v
;f
v
g into M. Observe that fe
v
;f
v
g 2 A sine C
ishypernormal. Foranyedge e=(v;w)2(E[D)nC
we put the fe
v
;e
w
g into M. M is learly a perfet
mathing. It ontains edges of type B and hene has
positiveweight.
Assume nextthat A hasa perfet mathing M of
positive weight. We onstrut a simple hypernormal
yle in G
u
. For any edge fe
v
;f
v
g 2 M we put the
edges e and f into the set C. Sine for any edge
e=(v;w)2G
u
wehavenodese
v ande
w
inAandsine
bothnodesmustbemathedinaperfetmathing,this
rulewillonstrutaolletionofhypernormalylesin
G
u
. ut
We assume that all non-leaves in the dominane
graph G have outdegree at most two 7
. Observe that
we have one edge of type A for every edge of G, a
omplete graph on 2+indeg
v
nodes for every root
v, and a graph of size 1+outdeg
v
for every leaf v.
Thus the auxiliary graph A has n 0
= m nodes and
m 0
=O(m)+ P
v2V
(2+indeg
v )
2
edges. ThegraphG
anbereduedintime O(nm),see [AGU72℄. Then we
havenoparalleledges,andhenearootrwithindegree
greater than n must have two dominane edges from
dierent leavesof the sametree to r, whih is trivial
to reognize in time O(nm). So we an assume that
theindegree ofanyroot isat most n. Letus saythat
wehave r n roots and letd
i
bethe indegree of the
i-th root. We have P
r
i=1 d
i
m and d
i
n. What
is the maximum value of S = P
i (2+d
i )
2
? We have
S =O(n+m)+ P
i d
2
i
. Thesum P
i d
2
i
is maximized
ifwemakethed
i
sasunequalaspossible. Soweattain
themaximum ifwe set m=nof thed
i
s equalto n and
all others equal to zero. Thus P
v2V
(2+indeg
v )
2
=
O(n+m)+O(m=nn 2
)=O(mn). Amaximalweighted
mathinginagraphwithn 0
nodesandm 0
edgesanbe
foundin timeO(n 0
m 0
logn 0
),see [GMG86℄.
Theorem5.1. The existene of a hypernormal yle
an be deided in time O(n 0
m 0
logn 0
), where n 0
= m
and m 0
= O(m)+ P
v2V
(2+indeg
v )
2
. A (simple)
7
Weanreplaeeahnon-leafwithoutdegree morethantwo
anditshildrenbyasmallbinarytree.Thisonstrutioninreases
thenumberofnodesandthenumberofedgesonlybyaonstant
fator.
1 2 k
:::
Figure7: Embeddedhainoflengthk.
hypernormalyle(ifitexists)anbefoundinthesame
timebound.
Inourappliationm=O(n)andtheindegreesare
bounded (theoutdegreesare not)andheneongura-
bilityanbedeidedin timeO(n 2
logn). Intheworst
ase,therunningtimeisO(nm 2
logn).
6 EÆient Enumeration
Arstappliationofthepolynomial-timeongurabil-
itytestfromtheprevioussetionistomaketheenumer-
ationofsolvedformsmoreeÆient. Wemodifytheenu-
merationalgorithmfromSetion3bytestingfor(undi-
reted)simple hypernormal yles in step 2instead of
diretedarbitrary yles. Thereursion will terminate
immediately one the graph beomes unongurable,
and we know that the reursion depth is bounded by
n 2
. Thus:
Corollary6.1. A solved form of a solvable domi-
nane graph an be onstruted intime O(n 3
m 2
logn).
If a dominane graph has N solved forms, they an be
enumeratedin timeO(Nn 3
m 2
logn).
NotethatNanstillbeexponentialinn. Alsonote
that we anget ongurationsinstead of solvedforms
in thesameasymptoti time, by applyingLemma 2.1:
Simpliation Rule 1 an only be applied at most
n 2
times either, by a similar argument about the
reahabilityrelation.
Goingbaktotheappliationinomputationallin-
guistisdesribedintheintrodution,thealgorithmfor
enumeratingongurationsthat wehavejust skethed
gives us a straightforward algorithm for enumerating
modelsofanormaldominaneonstraint. Wehaveim-
plementedthisalgorithm,andthisgivesusasigniant
improvement in runtimes over earlier solversfor dom-
inane onstraints. By way of example, onsider the
dominanegraphin Figure 7. Thisgraphisanembed-
dedhain oflengthk. Suhgraphsappearintheappli-
ation;forinstane,thegraphfor\Johnsaysthatevery
linguistspeakstwolanguages"isanembeddedhainof
3 5 20 180
4 14 190 670
5 42 1210 5900
6 132 4130 12740
7 429 16630 46340
8 1430 255000 n/a
Figure8: Runtimesonembeddedhainsoflengthk. N
istherespetivenumberofongurations.Timesarein
milliseondsCPUtime.
embeddedhainsofvariouslengths(ona550MHzPen-
tiumIII)aredisplayedinFigure8. Inthetable,\new"
refersto the algorithm skethed above; \old" refersto
thedominaneonstraintsolverdesribedin [DG99℄.
7 DominaneGraphs with Closed Leaves
Aslightextensionoftheongurationproblembylosed
leaves beomesNP-ompleteagain. Adominanegraph
with losed leavesis givenby adominanegraphG =
(V;E _
[D)andasetLofleaves. ThemembersofLare
alled losed, all other leaves are alled open. Closed
leaves annot be the soure of dominane wishes. A
solved form of (G;L) with losed leavesL is a solved
form G 0
= (V;E[D 0
) of G whih has the additional
propertythat there is no edge (l;v)2 E 0
with l 2 L,
butthereisanedge(l;v)2D 0
foreveryl2=L. Inother
words, it is not allowed to attah a tree to a losed
leaf,and everyopenleafmustbe\plugged"withsome
other tree. We showthat theongurationproblemof
dominanegraphswithlosedleavesisNP-ompleteby
reduingthe3-partitionproblemto it.
8
Fat7.1. (3-partition) Let A denote a multiset
fa
1
;:::;a
3m
gof integers and B 2 N suhthat B=4 <
a
i
<B=2for alli;and P
3m
i=1 a
i
=mB. Thequestion is
whetherthereisapartitionA
1
℄:::℄A
m
ofAsuhthat
for alli, P
a2Ai
a=B. Theproblem isNP-ompletein
the strongsense [GJ79 ,problem SP15,page 224℄.
We desribethe redutionnow,whih is shown in
Figure 9. The tree T has m leaves. Eah leaf wants
todominateB+1losedsubtrees (i.e.,subtrees whih
haveonly losed leaves). T is requiredto be thehild
ofsomenodel. Thisnodelalsowantstodominatethe
treest
1 , ..., t
3m
. Foralli,thetree t
i hasa
i
+1open
leaves.
8
Exatlythesameredutionworksifwedo notrequireopen
leavestohaveoutgoingdominaneedgesinsolvedforms;sothis
modiedproblemisNP-ompleteaswell.
m 1
B+1 B+1 l
t
1
t
3m t
2 T
Figure 9: The dominane graph onstruted in the
redutionof3-partition.
Theorem 7.1. The ongurability problem for domi-
nanegraphs withlosedleavesis NP-omplete.
Proof. Consider an instane (A;B) of the 3-partition
problem and the dominane graph G onstruted in
the redution. We show that the instane (A;B) has
asolutioniGisongurable.
Assume rst that the 3-partition problem has a
solution. Observethat eah of the sets A
i
must have
ardinalitythree. LetA
i
=fa
x
i
;a
y
i
;a
z
i
gbeoneofthe
sets in the partition. Then a
x
i +a
y
i +a
z
i
= B. We
plug t
xi
ashild into the i-th leaf of T, t
yi
into some
leaf of t
xi and t
zi
into someleaf of t
yi
. Then thetree
T has a
xi
+1+a
yi
+1+a
zi
+1 2 = B +1 open
leavesbelowitsi-thleaf. Theseleavesarepluggedwith
theB+1losedsubtreeswhihthei-thleafofT wants
to dominate. Finally, we plug l with T and obtain a
ongurationofG.
Assume next that the dominane graph G has a
onguration. Consider the subtree plugged to the i-
th leaf of T. It ontains a subset A
i
of the trees
ft
1
;:::;t
3m
g. We must have P
tj2Ai (a
j
+1) B +
1+jA
i
j 1,sineB+1losedsubtreesmustbeplugged
into someopenleaf and sineeverysubtreein A
i also
requiresanopenleaf.
We next show that jA
i
j 3for all i. It is lear that
A
i
annotbeempty(sineB >0). IfA
i
isasingleton,
i.e. A
i
= ft
x
g, we have a ontradition sine t
x has
a
x
+1< B=2+1 B+1 leaves. Now onsider the
ase, where A
i
onsists of two elements t
x and t
y . By
attahingt
x andt
y
belowthei-thleaf ofT, weobtain
a
x +1+a
y
+1 1<B=2+1+B=2=B+1openleaves,
whihisalsoaontradition.
Sine eah set A
i
has ardinality at least three, sine
we have m sets, and sine there are 3m elements to
distribute, we onlude that jA j = 3 for all i. Thus
tj2Ai a
j
B foreveryi. Finally, weobservethat we
haveequalitysine P
a2A
a=mB. Thus wealsohave
asolutionforthe3-partitionproblem. ut
Note thatfor solvability ofdominanegraphswith
losed leaves, Theorem 4.1 still holds. That is, solv-
ability is still a polynomial problem. The dierene
to theunrestrited problem is that Lemma 2.1 breaks
down: All the graphs we onstrut in the enoding of
3-partition are in solved form, but they may well be
unongurable.
The relevane of this resultis again in its relation
to omputational linguistis. There are alternative
approahestosope[Bos96℄whihrequirethattheholes
and roots of the trees must be paired uniquely: The
roots mustbe\plugged"intotheroots,andeveryhole
mustbeplugged. Thisorrespondstomakingtheholes
openleaves,andallotherslosedleaves. Hene,wean
showthatthesatisabilityproblemsofthesealternative
approahesmustbeNP-ompleteaswell.
8 Conlusion
We have presented a polynomial time algorithm that
solvestheongurationproblem of dominanegraphs.
This problem is of interest to appliations: It an be
usedto enodesatisability of normaldominaneon-
straints,aformalismusedin omputationallinguistis.
Thus, our result establishes a dierene in omplex-
ity between normal dominane onstraints and unre-
strited dominane onstraints, whose satisability is
NP-omplete. Previously, no polynomial time algo-
rithms for any interestingfragment of dominaneon-
straintswereknown. Testswitharstimplementation
showthat thepresentedgraphalgorithmalsoimproves
inruntimeonaprevioussolverfor(unrestrited)dom-
inaneonstraints.
Referenes
[AGU72℄ A.V.Aho,M. R.Garey, andJ.D.Ullman. The
transitiveredutionofadiretedgraph. SIAMJournal
onComputing,1:131{137,1972.
[Bos96℄ JohanBos. Prediatelogiunplugged. InProeed-
ingsofthe10thAmsterdamColloquium,pages133{143,
1996.
[Cor94℄ Thomas Cornell. Ondetermining the onsisteny
of partial desriptions of trees. In Pro. of the 32nd
Annual Meeting of the Assoiation for Computational
Linguistis,pages163{170,1994.
[DG99℄ DenysDuhierand Claire Gardent. A onstraint-
basedtreatment ofdesriptions. InProeedings of the
3 rd
Intern. Workshop on Comp. Semantis, Tilburg,
1999.
[DN00℄ Denys Duhier and Joahim Niehren. Dominane
onstraints with set operators. In Proeedings of the
FirstInternationalConfereneonComputationalLogi
(CL2000),LNCS.Springer,July2000.
[ENRX98℄ M. Egg, J. Niehren, P. Ruhrberg, and F. Xu.
Constraints over Lambda-StruturesinSemanti Un-
derspeiation. In Proeedings COLING/ACL'98,
Montreal,1998.
[GJ79℄ M.R. Garey and D.S Johnson. Computers and
Intratability: A Guide to the Theory of NP-
ompleteness. W.H.FreemanandCompany,1979.
[GMG86℄ Z. Galil, S. Miali, and H.N. Gabow. An
O(EV logV)algorithmforndingamaximalweighted
mathing ingeneral graphs. SIAM Journal on Com-
puting,15:120{130,1986.
[GW98℄ Claire Gardent and Bonnie Webber. Desribing
disoursesemantis. In Proeedings of the 4th TAG+
Workshop, Philadelphia, 1998. University of Pennsyl-
vania.
[KMN00℄ Alexander Koller, Kurt Mehlhorn, and Joahim
Niehren. A polynomial-time fragment of dominane
onstraints. InPro. of the 38thAnn. Meeting of the
Ass.forComputationalLinguistis,2000.
[KNT98℄ Alexander Koller, Joahim Niehren, and Ralf
Treinen. Dominaneonstraints: Algorithmsandom-
plexity. InPro.of the3 th
Conf.onLogialAspetsof
Comp.Linguistis,1998. ToappearasLNCS.
[MHF83℄ Mithell P. Marus, Donald Hindle, and Mar-
garetM.Flek. D-theory: Talkingabouttalkingabout
trees. InPro.of the 21st Ann. Meet. of theAss. for
Comp.Linguistis,pages129{136,1983.
[MN99℄ K.MehlhornandS.Naher. TheLEDAPlatformfor
Combinatorial andGeometri Computing. Cambridge
UniversityPress,1999. 1018pages.
[MNSU℄ K. Mehlhorn, S. Naher, M. Seel, and C. Uhrig.
The LEDA User Manual. Tehnial report, Max-
Plank-Institut fur Informatik. http://www.mpi-
sb.mpg.de/LEDA/leda.html.
[Mus95℄ R.A. Muskens. Order-Independene and Under-
speiation. InJ. Groenendijk, editor, Ellipsis, Un-
derspeiation,EventsandMore inDynamiSeman-
tis.DYANADeliverableR.2.2.C,1995.
[RVSW95℄ Owen Rambow, K. Vijay-Shanker, and David
Weir. D-TreeGrammars. InPro.of the33rdAnnual
MeetingoftheAssoiationforComputational Linguis-
tis,1995.
[Sh00℄ G. Shafer. Max-Weighted-Mathing in general
graphs. Master's thesis,Fahbereih Informatik,Uni-
versitatdesSaarlandes,Saarbruken,2000.
[TW67℄ J. W. Thather and J. B. Wright. Generalized
niteautomatatheorywithanappliationtoadeision
problem of seond-order logi. Mathematial Systems
Theory,2(1):57{81,August1967.
[VS92℄ K.Vijay-Shanker. Using desriptions of trees in a
tree adjoining grammar. Computational Linguistis,
18:481{518, 1992.
[VSWR95℄ K.Vijay-Shanker,DavidWeir,andOwenRam-
[Zie95℄ T. Ziegler. Max-Weighted-Mathing auf allge-
meinen Graphen. Master's thesis, Fahbereih Infor-
matik,UniversitatdesSaarlandes,Saarbruken,1995.