HAL Id: hal-00330580
https://hal.archives-ouvertes.fr/hal-00330580v2
Submitted on 20 Oct 2008
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.
optimal mesh encoding and to random sampling
Eric Fusy, Dominique Poulalhon, Gilles Schaeffer
To cite this version:
Eric Fusy, Dominique Poulalhon, Gilles Schaeffer. Dissections, orientations, and trees, with applica-
tions to optimal mesh encoding and to random sampling. ACM Transactions on Algorithms, Associ-
ation for Computing Machinery, 2008, 4 (2), pp.Art.19. �hal-00330580v2�
and to random sampling
ÉRICFUSY,DOMINIQUEPOULALHONandGILLESSCHAEFFER
É.FandG.S: LIX,ÉolePolytehnique. D.P:Liafa,Univ. Paris 7. Frane
Wepresentabijetionbetweensomequadrangulardissetionsofanhexagonandunrootedbinary
trees,withinterestingonsequenesforenumeration,meshompressionandgraphsampling.
Ourbijetionyieldsaneientuniformrandomsamplerfor3-onnetedplanargraphs,whih
turns out to bedeterminant for the quadrati omplexityof the urrent best known uniform
randomsamplerforlabelledplanargraphs[Fusy,AnalysisofAlgorithms2005℄.
ItalsoprovidesanenodingforthesetP(n)ofn-edge3-onnetedplanargraphsthatmathes
theentropybound
1
nlog2|P(n)|= 2 +o(1)bitsperedge(bpe). Thissolvesatheoretialproblem
reentlyraisedinmeshompression,asthesegraphsabstrattheombinatorialpartofmesheswith
spherialtopology.Wealsoahievetheoptimalparametrirate
1
nlog2|P(n, i, j)|bpeforgraphs
ofP(n)withivertiesandjfaes,mathinginpartiulartheoptimalratefortriangulations.
Ourenoding relies on alinear timealgorithmto ompute an orientation assoiatedto the
minimalShnyderwoodofa3-onnetedplanarmap.Thisalgorithmisofindependentinterest,
anditisforinstaneakeyingredientinareentstraightlinedrawingalgorithmfor3-onneted
planargraphs[Bonihonetal.,GraphDrawing2005℄.
CategoriesandSubjetDesriptors: G.2.1[DisreteMathematis℄:Combinatorialalgorithms
GeneralTerms: Algorithms
AdditionalKeyWordsandPhrases:Bijetion,Counting,Coding,Randomgeneration
1. INTRODUCTION
OneoriginofthisworkanbetraedbaktoanartileofEdBenderintheAmer-
ianMathematial Monthly [Bender1987℄,whereheaskedforasimpleexplanation
oftheremarkableasymptotiformula
|P(n, i, j)| ∼
1 3
52
4ijn
2i
−2 j + 2
2j
−2 i + 2
(1)
fortheardinalityofthesetof 3-onneted(unlabelled) planargraphswith
i
ver-ties,
j
faesandn = i + j
−2
edges,n
goingtoinnity. ByatheoremofWhitney[1933℄,thesegraphshaveessentiallyauniqueembeddingonthesphereuptohome-
omorphisms,sothattheirstudyamountstothatofrooted3-onnetedmaps,where
amapisagraphembeddedintheplaneandrooted meanswithamarkedoriented
edge.
1.1 Graphs,dissetionsandtrees
Anotherknownpropertyof3-onnetedplanargraphswith
n
edgesisthefatthattheyarein diret one-to-one orrespondenewith dissetions ofthesphereinto
n
quadranglesthathavenonon-faial4-yle. Theheartofourpaperliesinafurther
one-to-oneorrespondene.
Theorem 1.1. There is a one-to-one orrespondene between unrooted binary
trees with
n
nodes and unrooted quadrangular dissetions of an hexagon withn
interiorvertiesandnonon-faial 4-yle.
Themappingfrombinarytreestodissetions,whihweallthelosure,iseasily
desribedandresemblesonstrutionsthatwerereentlyproposedforsimplerkinds
ofmaps [Shaeer1997;Bouttieret al.2002; Poulalhonand Shaeer2006℄. The
proof that the mapping is a bijetion is instead rather sophistiated, relying on
new properties of onstrained orientations [Ossona de Mendez 1994℄, related to
Shnyder woods of triangulations and 3-onneted planar maps [Shnyder 1990;
di Battistaet al.1999;Felsner2001℄.
Conversely, thereonstrution of the treefrom thedissetion relies onalinear
time algorithm to ompute the minimal Shnyder woods of a 3-onneted map
(or equivalently, the minimal
α
0-orientation of the assoiated derived map, see Setion 9). This problem is of independant interest and our algorithm has forexample appliations in the graph drawing ontext [Bonihon et al. 2007℄. It is
akin to Kant's anonial ordering [Kant 1996; Chuang et al. 1998; Bonihon et
al.2003;Castelli-AleardiandDevillers2004℄,but againtheproofoforretnessis
quiteinvolved.
Theorem 1.1 leads diretly to the impliit representation of the numbers |Pn′|
ountingrooted 3-onnetedmaps with
n
edgesdue toTutte [1963℄), anditsrenement asdisussed in Setion 5yields that of |Pij′ | the number of rooted 3-
onnetedmapswith
i
vertiesandj
faes(duetoMullinandShellenberg[1968℄) from whih Formula(1)follows. It partiallyexplains theombinatorisoftheo-urrene of the ross produt of binomials, sine these are typial of binary tree
enumerations. Letus mentionthattheone-to-one orrespondenespeializespar-
tiularlynielytoountplanetriangulations(i.e.,3-onnetedmapswithallfaes
ofdegree 3),leadingtotherstbijetivederivationoftheountingformulaforun-
rootedplane triangulations with
i
verties,originallyfoundbyBrown[1964℄usingalgebraimethods.
1.2 Randomsampling
A seond byprodut of Theorem 1.1 is an eient uniform random sampler for
rooted3-onnetedmaps,i.e.,analgorithmthat,given
n
,outputsarandomelementin theset Pn′ of rooted3-onneted maps with
n
edgeswith equalhanes forallelements. Thesamepriniplesyield auniformsamplerforPij′ .
The uniform random generation of lasses of maps like triangulations or 3-
onneted graphs was rst onsidered in mathematial physis(see referenes in
[Ambjørn et al. 1994; Poulalhon and Shaeer 2006℄), and various types of ran-
dom planargraphs areommonly used fortesting graph drawingalgorithms (see
[de Fraysseixetal.℄).
Thebest previouslyknown algorithm[Shaeer1999℄ hadexpetedomplexity
O(n
5/3)
forPn′, andwasmuhlesseientforPij′ ,havingevenexponentialom- plexityfori/j
orj/i
tendingto 2(dueto Euler'sformulatheseratioareboundedaboveby2for3-onnetedmaps). InSetion6,weshowthatourgeneratorforPn′
orPij′ performsin lineartime exeptif
i/j
orj/i
tends to 2whereit beomes atmostubi.
Fromthetheoretialpointofview,itisalsodesirabletoworkwiththeuniform
distributiononplanargraphs. However,random(labelled)planargraphsappearto
behallengingmathematial objets[Osthus et al.2003; MDiarmidet al. 2005℄.
A Markovhain onverging to the uniform distribution on planar graphswith
i
vertieswasgivenbyDeniseetal.[1996℄,butitresistsknownapproahesforper-
fetsampling[Wilson2004℄,andhasunknownmixing time. Asopposed tothis,a
reursiveshemeto sampleplanargraphswasproposed byBodirsky etal. [2003℄,
with amortizedomplexity
O(n
6.5)
. This resultis basedonareursivedeompo-sition of planar graphs: a planar graphan be deomposed into a tree-struture
whosenodesareoupiedbyrooted3-onnetedmaps. Generatingaplanargraph
redues toomputing branhingprobabilitiessoastogenerate thedeomposition
treewithsuitableprobability;thenarandomrooted3-onnetedmapisgenerated
for eah node of the deomposition tree. Bodirsky et al.[2003℄ usethe so-alled
reursive method [Nijenhuis and Wilf 1978; Flajoletet al. 1994; Wilson 1997℄ to
takeadvantageof thereursivedeomposition ofplanargraphs. Ournewrandom
generatorforrooted3-onneted mapsredues theiramortizedostto
O(n
3)
. Fi-nallyanew uniformrandomgeneratorfor planargraphswasreentlydevelopped
byoneoftheauthors[Fusy2005℄,thatavoidstheexpensivepreproessingompu-
tations of[Bodirsky et al.2003℄. The reursivesheme issimilar to the oneused
in [Bodirsky et al. 2003℄, but the method to translate it to a random generator
reliesonBoltzmannsamplers,anewgeneralframeworkfortherandomgeneration
reently developed in [Duhon et al. 2004℄. Thanks to our random generatorfor
rooted 3-onneted maps, the algorithm of [Fusy 2005℄ has a time-omplexity of
O(n2
)
forexatsizeuniformsamplingandevenperformsinlineartimeforapprox-imatesizeuniformsampling.
1.3 Suintenoding
A third byprodut ofTheorem 1.1 is thepossibility to enodein linear timea 3-
onneted planargraphwith
n
edges by abinary treewithn
nodes. Inturn thetreeanbeenodedbyabalanedparenthesiswordof
2n
bits. Thisodeisoptimalintheinformationtheoretisense: theentropyperedgeofthislassofgraphs,i.e.,
the quantity
1
n
log
2|P(n)|, tends to 2whenn
goesto innity, so that a ode for P(n)
annotgiveabetterguaranteeontheompressionrate.Appliationsallingforompatstorageandfasttransmissionof3Dgeometrial
mesheshavereentlymotivatedahugeliteratureonompression,inpartiularfor
theombinatorialpartofthemeshes. Therstompression algorithmsdealtonly
withtriangularfaes[Rossigna1999;ToumaandGotsman1998℄,butmanymeshes
inlude largerfaes,sothatpolygonalmesheshavebeome prominent(see[Alliez
andGotsman2003℄forareentsurvey).
Thequestionofoptimalityofoderswasraisedinrelationwithexeptionodes
produed by several heuristiswhen dealingwith meshes withspherialtopology
[Gotsman2003;Khodakovskyet al.2002℄. Sinethesemeshesareexatlytriangu-
lations(fortriangularmeshes)and3-onnetedplanargraphs(forpolyhedralones),
theodersin[PoulalhonandShaeer2006℄andin thepresentpaperrespetively
provethat traversalbasedalgorithmsanahieveoptimality.
On the other hand, in the ontext of suint data strutures, almost optimal
algorithmshavebeenproposed[Heetal.2000;Lu2002℄,thatarebasedonseparator
theorems. Howeverthese algorithmsarenottruly optimal(they get
ε
losetotheentropybut at theost of an unontrolled inrease of theonstantsin thelinear
omplexity). Moreover,although theyrelyonasophistiated reursivestruture,
theydonotsupporteientadjaenyrequests.
As opposed to that, ouralgorithm shares with [Heet al.1999; Bonihon et al.
2003℄ thepropertythat it produesessentiallythe ode ofaspanning tree. More
preiselyitisjustthebalanedparenthesisodeofabinarytree,andadjaeniesof
theinitialdissetionthatarenotpresentinthetreeanbereoveredfromtheode
byasimplevariationontheinterpretation ofthesymbols. Adjaenyqueriesan
thusbe dealt within time proportionalto thedegreeof verties[Castelli-Aleardi
etal.2006℄usingtheapproahof[MunroandRaman1997;Heetal.1999℄.
FinallyweshowthattheodeanbemodiedtobeoptimalonthelassP
(n, i, j)
.Sine the entropy of this lass is stritly smaller than that of P
(n)
as soon as|i−
n/2| ≫ n
1/2,theresultingparametrioderis moreeientin thisrange. Inpartiularinthease
j = 2i
−4
ournewalgorithmspeializestoanoptimaloderfortriangulations.
1.4 Outlineofthepaper
Thepaperstartswithtwosetionsofpreliminaries: denitionsofthemapsandtrees
involved (Setion 2), and somebasi orrespondenes between them (Setion 3).
Then omes our main result (Setion 4), the mappingbetweenbinary trees and
somedissetionsofthehexagonbyquadrangularfaes. Thefatthatthismapping
isabijetionfollowsfromtheexisteneanduniquenessofaertaintri-orientationof
ourdissetions. Theproofofthisauxiliarytheorem,whihrequirestheintrodution
oftheso-alledderivedmapsandtheir
α
0-orientations,isdelayedtoSetion8,that is, after the three setions dediated to appliations of our main result: in thesesetions we suessively disuss ounting (Setion 5), sampling (Setion 6) and
oding (Setion 7) rooted 3-onneted maps. The third appliation leads us to
our seond important result: in Setion 9 we present a linear time algorithm to
ompute the minimal
α
0-orientation of the derived map of a 3-onneted planar map (whih also orresponds to the minimal Shnyder woods alluded to above).Finally,Setion10isdediatedtotheorretnessproofofthisorientationalgorithm.
Figure 1summarizes theonnetions betweenthe dierent familiesof objetswe
onsider.
2. DEFINITIONS
2.1 Planarmaps
Aplanarmap isaproperembeddingofanunlabelledonnetedgraphintheplane,
where proper means that edges are smooth simple ars that do notmeet but at
their endpoints. A planar map is said to be rooted if oneedge of the outerfae,
alled the root-edge, is marked and oriented suh that the outer fae lays on its
right. Theoriginoftheroot-edgeisalled root-vertex. Vertiesandedgesaresaid
to be outer orinner dependingon whetherthey areinidentto theouter fae or
not.
Aplanarmapis3-onnetedifithasatleast4edgesandannotbedisonneted
bytheremovaloftwoverties. Therst3-onnetedplanarmapisthetetrahedron,
3-onnetedplanargraphs
3-onnetedmaps derivedmaps irreduible
quadrangulations
derivedmaps
withorientation dissetions
ofthehexagon
dissetionsofthehexagon
withorientation binarytrees
parenthesisode
iterative
algorithm transposition
operations opening
losure
rejetion
Whitney
folklore
Fig.1. Relationsbetweeninvolvedobjets.
whihhas6edges. WedenotebyPn′ (respetivelyPij′ )thesetofrooted3-onneted
planarmapswith
n
edges(resp.i
vertiesandj
faes). A3-onnetedplanarmapisouter-triangular ifitsouterfaeistriangular.
2.2 Planetrees,andhalf-edges
Planetrees are planarmaps withasinglefaetheouterone. A vertexis alled
a leaf ifit has degree 1,and node otherwise. Edgesinident to a leaf are alled
stems,andtheotherarealledentireedges. Observethatplanetreesareunrooted
trees.
Binary trees areplanetreeswhosenodeshavedegree3. Byonventionweshall
requirethat arootedbinary tree hasaroot-edgethat is astem. The root-edgeof
a rooted binary tree thus onnets a node, alled the root-node, to a leaf, alled
theroot-leaf. Withthisdenitionofrootedbinarytree,upondrawingthetreeina
topdownmannerstartingwiththeroot-leaf,everynode(inludingtheroot-node)
hasafather, aleft sonandarightson. This (veryminor) variationon theusual
denition ofrootedbinarytreeswillbeonvenientlateron. For
n
≥1
, wedenoterespetivelybyBn andB′n thesetsofbinaryandrootedbinarytreeswith
n
nodes(theyhave
n + 2
leaves,asprovedbyindutiononn
). Theserootedtreesarewellknownto beountedbytheCatalannumbers: |Bn′|
=
n+11 2nn.
Thevertiesofabinarytreeanbegreedilybioloredsayinblakorwhite
sothat adjaentvertieshavedistintolors. Thebiolorationisuniqueuptothe
hoie of the olor of the rst node. As a onsequene, rooted biolored binary
trees are either blak-rooted or white-rooted, depending on the olor of the root
node. Thesetsofblak-rooted(resp. white-rooted)binarytreeswith
i
blaknodesand
j
white nodes is denoted by Bij• (resp. by Bij◦); and the total set of rootedbioloredbinarytreeswith
i
blaknodesandj
whitenodesisdenotedbyB′ij.Itwillbeonvenientto vieweahentireedgeofatreeasapairofoppositehalf-
edges eahoneinidenttooneextremityoftheedgeandtovieweahstemas
asinglehalf-edgeinidenttothenodeholdingthestem. Moregenerallyweshall
onsidermapsthathaveentireedges (madeoftwohalf-edges)andstems (madeof
onlyonehalf-edge). Itisthenalsonaturaltoassoiateonefaeto eahhalf-edge,
say,thefae onitsright. In theaseof trees,thereis onlytheouterfae,sothat
allhalf-edgesgetthesameassoiatedfae.
2.3 Quadrangulationsanddissetions
A quadrangulation is a planar map whose faes (inluding the outer one) have
degree4. Adissetionof thehexagonbyquadrangularfaes isaplanarmapwhose
outerfaehasdegree6andinnerfaeshavedegree4.
Cylesthatdonotdelimitafaearesaidtobeseparating. Aquadrangulationor
adissetionofthehexagonbyquadrangularfaesissaidtobeirreduible ifithasat
least 4faes andhasno separating4-yle. Therst irreduiblequadrangulation
is the ube, whih has 6 faes. We denote by Q′n the set of rooted irreduible
quadrangulations with
n
faes, inluding the outer one. Euler's relation ensuresthatthese quadrangulationshave
n + 2
verties. WedenotebyDn (D′n)thesetof(rooted, respetively)irreduible dissetionsof thehexagonwith
n
inner verties.These have
n + 2
quadrangular faes, aording to Euler's relation. From now on, irreduible dissetions of the hexagon by quadrangular faes will simply bealled irreduible dissetions. The lasses of rooted irreduible quadrangulations
and of rooted irreduible dissetions arerespetivelydenoted byQ′
=
∪nQ′n and D′=
∪nD′n.As faes of dissetions and quadrangulations haveeven degree, the verties of
these maps an begreedily biolored, say, in blak and white, so that eah edge
onnets a blak vertex to awhite one. Suh abioloration is unique up to the
hoie of the olors. We denote by Q′ij the set of rooted biolored irreduible
quadrangulationswith
i
blakvertiesandj
whitevertiesandsuhthattheroot-vertexisblak;and byDij′ theset ofrootedbioloredirreduible dissetionswith
i
blakinner vertiesandj
whiteinner vertiesandsuh that theroot-vertexis blak.Abioloredirreduibledissetionisomplete ifthethreeouterwhitevertiesof
thehexagonhavedegreeexatly2. Hene,thesethreevertiesareinidentto two
adjaentedgesonthehexagon.
3. CORRESPONDENCESBETWEENFAMILIESOF PLANARMAPS
This setion reallsa folklore bijetion between irreduiblequadrangulations and
3-onnetedmaps, hereafteralledangularmapping,see [MullinandShellenberg
1968℄,anditsadaptationtoouter-triangular3-onnetedmaps.
3.1 3-onnetedmapsandirreduiblequadrangulations
Letusrstreallhowtheangularmappingworks. Givenarootedquadrangulation
Q
∈ Q′n endowed withits vertex bioloration,letM
be therooted map obtainedbylinking,foreahfae
f
ofQ
(eventheouter fae),thetwodiagonallyopposedblak vertiesof
f
; the root ofM
is hosento be the edge orresponding to the outerfaeofQ
,orientedsothatM
andQ
havesameroot-vertex,seeFigure2. The mapM
is oftenalled theprimal map ofQ
. A similar onstrution using whitevertiesinsteadofblakones wouldgiveitsdual map (i.e., themapwithavertex
(a)Aquadrangulation (b)withitsblakdiagonals ()givesaplanarmap.
Fig.2.Theangularmapping:fromarootedirreduiblequadrangulationtoarooted3-onneted
planarmap.
in eahfae of
M
andedge-setorrespondingto theadjaenies betweenverties andfaesofM
).Theonstrutionof the primalmap is easily invertible. Givenanyrooted map
M
,theinverseonstrutiononsistsinaddingavertexalledafae-vertex ineahfae (eventhe outerone) of
M
and linking avertexv
andafae-vertexv
f byanedge if
v
is inident to the faef
orresponding tov
f. Keeping onlythese fae-vertexinidene edges yields a quadrangulation. The root is hosenas the edge
thatfollowstherootof
M
in ounter-lokwiseorderarounditsorigin.Thefollowingtheoremisalassialresultin thetheoryofmaps.
Theorem 3.1 (Angularmapping) . The angular mapping is a bijetion be-
tween Pn′ andQ′n andmorepreisely abijetion betweenPij′ andQ′ij.
3.2 Outer-triangular3-onnetedmapsandbioloredompleteirreduibledissetions
Thesameprinipleyieldsabijetion,alsoalled angularmapping,betweenouter-
triangular3-onnetedmapsand bioloredompleteirreduibledissetions,whih
will prove very useful in Setions 7 and 8. This mapping is very similar to the
angular mapping: given aomplete dissetion
D
, assoiatetoD
themapM
ob-tainedbylinkingthetwoblakvertiesofeahinnerfae of
D
byanewedge,seeFigure3. Themap
M
isalled theprimal map ofD
.Theorem 3.2 (Angularmappingwith border). Theangularmapping,for-
mulated for omplete dissetions, is a bijetion between biolored omplete irre-
duible dissetions with
i
blak verties andj
white verties and outer-triangular 3-onnetedmaps withi
verties andj
−3
innerfaes.Proof. Theprooffollowssimilar linesasthatof Theorem3.1,see [Mullinand
Shellenberg1968℄.
3.3 Derivedmaps
Initsversionforompletedissetions,theangularmappinganalsobeformulated
usingtheoneptofderivedmap,whihwillbeveryusefulthroughoutthisartile
(inpartiularwhendealingwithorientations).