Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller,...

27
Trapezoid graphs and Trapezoid graphs and generalizations, generalizations, geometry and geometry and algorithms algorithms Stefan Felsner, Rudolf M Stefan Felsner, Rudolf M ü ü ller, LorenzWernisch ller, LorenzWernisch

Transcript of Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller,...

Page 1: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Trapezoid graphs and Trapezoid graphs and generalizations, geometry generalizations, geometry

and algorithmsand algorithmsStefan Felsner, Rudolf MStefan Felsner, Rudolf Müüller, Lorenzller, Lorenz

WernischWernisch

Page 2: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

OutlineOutline

IntroductionIntroduction Trapezoid graphs and trapezoid ordersTrapezoid graphs and trapezoid orders Minimum antichain partition and maximum chMinimum antichain partition and maximum ch

ain for k-trapezoid ordersain for k-trapezoid orders Chain partitions of trapezoid ordersChain partitions of trapezoid orders Maximum antichain for trapezoid ordersMaximum antichain for trapezoid orders

Page 3: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

IntroductionIntroduction

G is a trapezoid graph ifG is a trapezoid graph if A trapezoid t A trapezoid t v v V The intersection between The intersection between

two trapezoid t1, t2 two trapezoid t1, t2 (v1, v2) (v1, v2) E, t1v1, t2v2

n: # of vertices in G or order P

Page 4: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Box representationBox representation

x=(xx=(x11,…,x,…,xkk), y=(y), y=(y11,…,y,…,ykk), x,y), x,yRk

x is dominated by y, if xi<yi i, denoted by x<y

Dominance order between points, boxes (l1,…,lk) is the lower corner,(u1,…,uk) is the upper

corner of the box A box b dominates a box b’ if the lower corner of

b dominates the upper corner of b’, l(b)>u(b’) b, b’ are comparable if b dominates b’ else incomp

arable

Page 5: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Representation between box and Representation between box and trapezoid trapezoid

Lower channel Lower channel x x coordinatecoordinate

Upper channel Upper channel y y coordinatecoordinate

Page 6: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Trapezoid graphs and trapezoid Trapezoid graphs and trapezoid ordersorders

K-dimensional box representation (V,K-dimensional box representation (V,ll,,uu)) ll:V:VRRkk, , uu:V:VRRkk

K-trapezoid graphK-trapezoid graph Weight w:VWeight w:VRR A set of mutually comparable elements of an orA set of mutually comparable elements of an or

der is a der is a chainchain A set of mutually incomparable elements is an A set of mutually incomparable elements is an

antichainantichain Maximal element Maximal element v in chain, v in chain, chain weight Wchain weight W(v)(v)

Page 7: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Perfect graphPerfect graph

A minimum clique cover of G is a minimum aA minimum clique cover of G is a minimum antichain partition of Pntichain partition of P

A maximum weighted independent set of G is A maximum weighted independent set of G is a maximum weighted chain in Pa maximum weighted chain in P

A minimum coloring of G is a minimum chain A minimum coloring of G is a minimum chain partition of Ppartition of P

A maximum weighted clique in G is a maximuA maximum weighted clique in G is a maximum weighted antichain in Pm weighted antichain in P

Page 8: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Minimum antichain partition and mMinimum antichain partition and maximum chain aximum chain

Longest increasing subsequenceLongest increasing subsequence Maximum chain problem for 2D order (V,Maximum chain problem for 2D order (V,pp))

Sort the points in xSort the points in x Plane sweep L from left to rightPlane sweep L from left to right W(m) is the weight of maximum weighted chain oW(m) is the weight of maximum weighted chain o

n the set dominated by m, for m n the set dominated by m, for m M

Page 9: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Algorithm MAXCHAINAlgorithm MAXCHAIN MAXCHAIN(V,MAXCHAIN(V,ll,,uu,,ww))

for each for each p p from left to right dofrom left to right do mm first marker below p on L first marker below p on L if if pp==ll(v) for some v (v) for some v V then

W(v)W(m)+w(v) link(v)origin(m)

if p=u(v) for some v V then if W(v)>W(m) then

insert a new mv at py in L W(mv)W(v) origin(mv)v Remove all m’ that are higher and lighter than mv from L

xorigin(uppermost marker on L) C{x} while link(x)≠nil do

xlink(x) CC∪{x}

Return C

Page 10: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

CorrectnessCorrectness

Lemma –At the end of the main loop in MAXCHAIN Lemma –At the end of the main loop in MAXCHAIN the following invariants holds true. If y is an arbitrary the following invariants holds true. If y is an arbitrary point on L and m is the next marker below y, then a point on L and m is the next marker below y, then a maximum weighted chain dominated by point y has maximum weighted chain dominated by point y has weight W(m)weight W(m) L stopped at point p=L stopped at point p=ll(v)(v) L stopped at point p=L stopped at point p=uu(v)(v)

y < uy < uyy(v) or no new marker is inserted(v) or no new marker is inserted

y y ≥ u≥ uyy(v) and m(v) and mv v is insertedis inserted Let m’and m be the markers below y before after mLet m’and m be the markers below y before after mv v is insertedis inserted Two cases: (1)m=m’ (2)m≠m’Two cases: (1)m=m’ (2)m≠m’

Page 11: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Minimum antichain partitionMinimum antichain partition

Simulated by unit weightsSimulated by unit weights # markers on L # markers on L ≤≤ |maximum chain| |maximum chain| No two points with the same weight are compaNo two points with the same weight are compa

rablerable AA11,…,A,…,Aww w=|longest chain| w=|longest chain|

Page 12: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

ConclusionConclusion

Theorem – A maximum weighted chain and a Theorem – A maximum weighted chain and a minimum antichain partition of a trapezoid ordminimum antichain partition of a trapezoid order on n points, given its box representation, caer on n points, given its box representation, can be computed in O(nlogn) time and linear span be computed in O(nlogn) time and linear spacece

Page 13: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

On k-trapezoid ordersOn k-trapezoid orders

Adopt dynamic multi-dimensional range treeAdopt dynamic multi-dimensional range tree Theorem – If an order P=(V,P) is given by box Theorem – If an order P=(V,P) is given by box

representation in representation in RRkk, then a minimum antichain , then a minimum antichain partition and a maximum chain of P can both bpartition and a maximum chain of P can both be obtained in O(nloge obtained in O(nlogk-1k-1n) time and O(nlogn) time and O(nlogk-2k-2n) sn) spacepace

Page 14: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Chain partitions of trapezoid ordersChain partitions of trapezoid orders

Minimum chain partitions for 2D order (V,Minimum chain partitions for 2D order (V,pp)) Plane sweep from left to rightPlane sweep from left to right Find the max y-value point on L below pFind the max y-value point on L below p Maximal elements of chains are maintained on L oMaximal elements of chains are maintained on L o

rdered by y-valuerdered by y-value C with maximum element v is C with maximum element v is closedclosed when u when u

(v) hasn’t been visited by L, otherwise (v) hasn’t been visited by L, otherwise openopen

Page 15: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Algorithm MINCHAINPARTITIONAlgorithm MINCHAINPARTITION(V,(V,ll,,uu))

MINCHAINPARTITION(V,MINCHAINPARTITION(V,ll,,uu)) for each for each pp from left to right do from left to right do

qqfirst element below first element below pp on L on L if if pp==ll(v) for some v (v) for some v V then

if q=u(v) for some w V then chain(v)chain(w)∪{v} remove q from L

else (q=d) chain(v){v}

if pp==uu(v) for some v (v) for some v V then Insert p at py in L

return {chain(v): u(v) L}

Page 16: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

CorrectnessCorrectness

CC={C={C11,…,C,…,Cαα} are the chain partitions} are the chain partitions v = the last element that opened a new chain, say Cv = the last element that opened a new chain, say Cαα

U = {v’:U = {v’:ll(v’)<(v’)<ll(v), (v), llxx(v)<(v)<uuxx(v’)}, U(v’)}, U {v} is an anticha∪in, C1 is the corresponding set of chains with U

All chains of C1 were closed after the L passed l(v) quarter-plane QP={(x,y): x≤lx(v), y≥ux(v)} X(v)={v’:l(v’)QP or u(v) QP} C2=C\(C1∪{CCαα}}) C2

*={sub-C from element in X(v):C C2}

Page 17: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

CorrectnessCorrectness

Lemma – The chain partition Lemma – The chain partition CC22* * of the order induced of the order induced

by X(v) is exactly the chain partition generated by MIby X(v) is exactly the chain partition generated by MINCHAINPARTITON, when the input consists of the NCHAINPARTITON, when the input consists of the boxes of elements in X(v) onlyboxes of elements in X(v) only L* is the sweep line for (X(v), l, u)L* is the sweep line for (X(v), l, u) The restriction of L to the half line above The restriction of L to the half line above llyy(v) and L* are i(v) and L* are i

dentical, for all xdentical, for all x≤≤llxx(v)(v) Four cases :Four cases :

p=p=ll(v’), v’(v’), v’X(v) p=p=ll(v’), v’(v’), v’X(v) p=p=uu(v’), v’(v’), v’X(v) p=p=uu(v’), v’(v’), v’X(v)

Page 18: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

ConclusionConclusion

antichain B={v’:unique v’antichain B={v’:unique v’C*, C*C2*}}

A=BA=B∪∪UU∪{v},|A|=|C| Theorem – A minimum chain partition of a traTheorem – A minimum chain partition of a tra

pezoid order on n points, given its box represepezoid order on n points, given its box representation can be computed in time O(nlogn) and ntation can be computed in time O(nlogn) and linear spacelinear space

Page 19: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Maximum antichain for trapezoid orMaximum antichain for trapezoid ordersders

shadowshadow(p)={q:p<q}(p)={q:p<q} shadowshadow(P)=(P)=∪∪ppPPshadow(p)shadow(p) staircase of a set of points S staircase of a set of points S is the topological boudaris the topological boudar

y of the shadow of the sety of the shadow of the set A(S)={vA(S)={vV:box(v)V:box(v)∩∩SS≠≠}}

Page 20: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Maximum antichain for trapezoid orMaximum antichain for trapezoid ordersders

Lemma – Let P be an order given by a box repLemma – Let P be an order given by a box representation. If S is a staircase then A(S) is an aresentation. If S is a staircase then A(S) is an antichain. Moreover, if A is an antichain of P thntichain. Moreover, if A is an antichain of P then there exists a staircase S such that A en there exists a staircase S such that A A(S)A(S)

∆ ∆ contains a list of contains a list of openopen boxes boxes ∆∆(y(y11,y,y22), y), y11≥y≥y22

Page 21: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Algorithm MAXANTICHAINAlgorithm MAXANTICHAIN for each for each pp from left to right do from left to right do

mmfirst marker above first marker above pp on L on L if if pp==ll(v) for some v (v) for some v V then

add add ww(v) to all markers in interval [l(v) to all markers in interval [lyy(v),u(v),uyy(v)](v)] insert a new item in insert a new item in ∆ at height u∆ at height uyy(v) with weight (v) with weight ww(v)(v) mm**next marker below next marker below pp on L on L while W(m)+ ∆(m,m*) > W(m*) dowhile W(m)+ ∆(m,m*) > W(m*) do

remove mremove m* * from Lfrom L mm**next marker below p on Lnext marker below p on L

if if pp==uu(v) for some v (v) for some v V then insert a new marker mv at py in L W(mv)W(m)+∆(m,m∆(m,mvv)) list(mv)list(m)∪{p} remove item at uy(v) from ∆∆

Tstaircase of points in list(lowest(L)) for each v V do

if v intersects T then AA∪{v} return A

Page 22: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

CorrectnessCorrectness

Lemma – At the end of the main loop of MAXLemma – At the end of the main loop of MAXANTICHAIN we have the following invariant. ANTICHAIN we have the following invariant. If y is an arbitrary point on L and m the next mIf y is an arbitrary point on L and m the next marker above y, then a maximum weighted stairarker above y, then a maximum weighted staircase that ends in y on L has weight W(m)+case that ends in y on L has weight W(m)+∆∆(m,y)(m,y) Before halt:W’,∆’ After halt:W,∆Before halt:W’,∆’ After halt:W,∆

Page 23: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

ll(v), y>(v), y>uuyy(v)(v)

ll(v), y<(v), y<uuyy(v)<m (v)<m W(m)+W(m)+∆(m,y)=W’(m)+(∆’(m,y)+w∆(m,y)=W’(m)+(∆’(m,y)+w

(v))(v)) ll(v), (v), llyy(v)<m<(v)<m<uuyy(v) (v) W(m)+W(m)+∆(m,y)=(W’(m)+m(v))+∆(m,y)=(W’(m)+m(v))+

∆’(m,y)∆’(m,y) ll(v),m<(v),m<llyy(v)(v)

W(m)+W(m)+∆(m,y)=W’(m)+∆’(m,y)∆(m,y)=W’(m)+∆’(m,y) W(m’)+∆(m’,y’)+∆(y’,m)+∆(m,y)=W(m’)+∆’(m’,m)+∆(m,W(m’)+∆(m’,y’)+∆(y’,m)+∆(m,y)=W(m’)+∆’(m’,m)+∆(m,

y)<W(m)+∆(m,y)y)<W(m)+∆(m,y)

CorrectnessCorrectness

y’m’

Page 24: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

ConclusionConclusion

Theorem – A maximum weighted antichain of Theorem – A maximum weighted antichain of a trapezoid order on n points, given its box repa trapezoid order on n points, given its box representation, can be computed in O(nlogn) and lresentation, can be computed in O(nlogn) and linear spaceinear space

Page 25: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Open problemOpen problem

Maximum antichain,… for k-trapezoid orderMaximum antichain,… for k-trapezoid order

Page 26: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Transform k-trapzoid to 2-trapezoidTransform k-trapzoid to 2-trapezoid

Page 27: Trapezoid graphs and generalizations, geometry and algorithms Stefan Felsner, Rudolf Müller, LorenzWernisch.

Transform k-permutation to 2-Transform k-permutation to 2-permutationpermutation