Title: color 1
1- color 1
- color 2
- color 3
- color 4
- color 5
- color 6
- color 7
2Sorting and Ranking in Partially Ordered Sets
- Costis Daskalakis
- Richard Karp
- Elchanan Mossel
- Sam Riesenfeld
- Elad Verbin
U.C. Berkeley
Tel Aviv University
3partially ordered set (poset)
- set P , binary dominance relation Â
- irreflexive (x x)
- transitive (x  y, y  z ) x  z)
- (P, Â) can be viewed as a DAG
- e.g. Z Z with natural partial order
x incomparable to y x y
4examples of posets
- Classical examples
- subsets (contains)
- elements of Rd (greater than, in all coordinates)
- elements of a DAG (reachable from)
- Rankings
- college applications (better scores, grades, ...)
- ice skaters (harder program, better executed)
- strains of bacteria (higher evolutionary fitness)
- router packet-dropping policies (more stringent)
- conference submissions
5problems on posets
- Natural to ask questions with analogies in total
orders - What is the complexity of sorting a poset,
- i.e. determining the relation between every pair
of elements? - How hard is it to find the minimal elements?
- These questions do not seem to have been
considered previously - Previous work assumes an underlying total order
6poset preliminaries
- chain set of mutually comparable elements
- anti-chain set of mutually incomparable
elements - width w(P ) size of maximum anti-chain
chain a  b  e
anti-chain b , c b
c
7diagrams of posets
- Not showing here many edges implied by
transitivity - Traditional diagram no edges implied by
transitivity
Hasse diagram transitive reduction of Â
8chain decompositions
- chain decomposition
- set of disjoint chains
- C1, C2, , Cq ?i Ci P
- width of decomposition is q
- example b  e , a  d , c  f
- q 3
- Dilworths Thm minimal-width decomposition has
width w(P) - example a  b  e , c  d  f
- q w(P ) 2
9sorting posets
- Sorting determine relations between all
elements in P - Query complexity
- Given an oracle such that query q(a, b ) gets
relation of a, b, how many queries are needed
to sort poset of width w on n elements? - trivial in extreme cases n log n if w(P )
1 n2 if w(P ) n - in practice w ltlt n and w gt 1
- Total complexity
- What is the running time required to sort a poset
of width w on n elements? - counts all computational operations ( query is a
single operation )
10chain-merge data structure
- Need a data structure for O(1)-time look-up of
the relation between any pair of elements - Naïve version n n table, O(n 2) time to build
- Alternative chain-merge data structure
- given a decomposition of P into q chains,
- build a chain-merge data structure in O( nq )
queries and time
11chain merge data structure
- Given a decomposition C1, , Cq of poset P
- for all i, 1 i q, for all x 2 Ci store
index of x in chain Ci - for all j, j ? i, store smallest element yi 2 Ci
such that yi  x - and largest element zi 2 Ci such that x  zi
y3
y5
x
y2
x
C4
C1
z5
C3
z2
C2
C5
12poset mergesort
- Mergesort algorithm for recursively sorting P
- if P w, return trivial decomposition into
chains of length 1 - else
- partition P into equal parts P 1, P 2
- Mergesort (P 1 ) and Mergesort (P 2 )
- results give decomposition of P into at most 2w
chains - reduce decomposition of P to have w chains
- return result
- At each level, number of chains reduced to w
13poset mergesort example
w 2
14poset mergesort example
15poset mergesort example
16poset mergesort example
a
c
b
d
f
e
17poset mergesort example
18example of peeling algorithm
- chains b  e , a  d , c  f
- S b, a, c
a
b
c
d
f
e
19example of peeling algorithm
- chains b  e , a  d , c  f
- S b, a, c
- a  b ) peel a and record (b, a)
a
b
c
d
f
e
20example of peeling algorithm
- chains b  e , a  d , c  f
- S b, a, c
- a  b ) peel a and record (b, a)
- S b, d, c
a
b
c
d
f
e
21example of peeling algorithm
- chains b  e , a  d , c  f
- S b, a, c
- a  b ) peel a and record (b, a)
- S b, d, c
- c  d ) peel c and record (d, c)
a
b
c
d
f
e
22example of peeling algorithm
- chains b  e , a  d , c  f
- S b, a, c
- a  b ) peel a and record (b, a)
- S b, d, c
- c  d ) peel c and record (d, c)
- S b, d, f
a
b
c
d
f
e
23example of peeling algorithm
- chains b  e , a  d , c  f
- S b, a, c
- a  b ) peel a and record (b, a)
- S b, d, c
- c  d ) peel c and record (d, c)
- S b, d, f
- d  f ) peel d and record (f, d)
a
b
c
d
f
e
24example of peeling algorithm
- chains b  e , a  d , c  f
- S b, a, c
- a  b ) peel a and record (b, a)
- S b, d, c
- c  d ) peel c and record (d, c)
- S b, d, f
- d  f ) peel d and record (f, d)
- reached bottom of chain a  d
a
b
c
d
f
e
25example of peeling algorithm
- 3 chains originally
- b  e , a  d , c  f
- sequence of peeling records
- (b, a), (d, c), (f, d)
- rearrange chains
- delete a ! d, add a ! b
- delete c ! f, add c ! d
- add d ! f
- 2 resulting chains
- a  b  e , c  d  f
a
b
c
d
f
e
26example of peeling algorithm
- 3 chains originally
- b  e , a  d , c  f
- sequence of peeling records
- (b, a), (d, c), (f, d)
- rearrange chains
- delete a ! d, add a ! b
- delete c ! f, add c ! d
- add d ! f
- 2 resulting chains
- a  b  e , c  d  f
a
b
c
d
f
e
27example of peeling algorithm
- 3 chains originally
- b  e , a  d , c  f
- sequence of peeling records
- (b, a), (d, c), (f, d)
- rearrange chains
- delete a ! d, add a ! b
- delete c ! f, add c ! d
- add d ! f
- 2 resulting chains
- a  b  e , c  d  f
a
b
c
d
f
e
28example of peeling algorithm
- 3 chains originally
- b  e , a  d , c  f
- sequence of peeling records
- (b, a), (d, c), (f, d)
- rearrange chains
- delete a ! d, add a ! b
- delete c ! f, add c ! d
- add d ! f
- 2 resulting chains
- a  b  e , c  d  f
29complexity of peeling and mergesort
- Given 2w chains on m elements, peeling requires
- O(wm) queries and time to reduce by 1 chain
- O(wm) queries, O(w2m) time overall
- Mergesort query complexity O( wn log (n/w) )
- Mergesort total complexity O( w2n log (n/w) )
- Question is this optimal?
30lower bound for sorting
- Theorem Brightwell and Goodall
- The number of posets of width w on n elements is
within a polynomial (in n) factor of n! 4n(w-1)
. - This implies that the query complexity of sorting
is - ? ( n log n wn ).
- How can we do better?
31total order optimal insertion sort
- Consider the following sorting algorithm for a
total order - Given an element x and a sorted set T,
- binary search T to find the smallest element y
such that y gt x - insert x immediately after y
- Insertion requires O( log n) queries
- Overall query complexity is O( n log n )
- What happens if we try this on posets?
32poset binary insertion sort
- Consider the following insertion sort for a
poset - Given an element x and a decomposition for a
sorted poset P, - for each chain Ci in the decomposition
- binary search Ci to find the smallest yi 2 Ci
such that yi  x - binary search Ci to find the largest zi 2 Ci
such that x  zi - Insertion requires O( w log n ) queries
- Overall query complexity is O( wn log n )
- No better but we gain intuition for what is
missing
33poset binary insertion sort
y1
x
C1
C2
34query-optimal poset sorting algorithm
- Must pay attention to relations between current
chains - this is actually not enough
- also need to take into account future insertions
- We give a sorting algorithm of query complexity
- O( n log n wn ).
- However, we do not know if it can be made
efficient
35beyond sorting finding minimal elements
- Problem Given a poset P, find its minimal
elements.
36minimal elements upper bound
- Deterministic algorithm to find minimal elements
of P - maintain a set S of candidates ( initially S
) - elements of S are mutually incomparable ) S w
- for each x 2 P
- compare x to all elments of S
- if there is y 2 S such that y  x, remove y
from S - if for all remaining y 2 S, x y, add x to S
- Takes at most wn queries and time O( wn )
- Randomization expected number of queries at
most
37minimal elements lower bound
- Theorem Any deterministic algorithm must make
at least n( w1)/2 - w queries to find the
minimal elments. - Proof is an algorithm for an adversary
- Factor of 2 off from the upper bound
- Randomized lower bound also off by about a factor
of 2 - Can generalize these bounds to the problem of
finding the k th layer of elements
38open problems
- What is the total complexity of sorting?
- Match the bounds for finding the minimal elements
and finding the k th layer - Other natural problems on partially ordered sets?
39thank you
40EXTRA SLIDES FOLLOW
41minimal elements lower bound
- Theorem In an adversarial model, at least n(
w1)/2 - w queries are needed to find the minimal
elments. - Proof is an algorithm for the adversary
- Adversarys responses correspond to a union of
disjoint chains - For each element x, keep a count t(x) queries
involving x so far - Given query q(a, b)
- if t(a) w-1, increment t(a) and output a b
- if t(a) w-1, choose chain for a different
from its neighbors - (do analogous steps for t(b) w-1)
- if t(a) gt w-1 and t(b) gt w-1
- if chains for a and b are different, return a
b - else respond according to some fixed indexing
of P
42minimal elements lower bound
- The count t for every element must be at least
w-1 - To get proof that an element is not minimal,
- it must be queried against at least w-1 other
elements - To get proof that an element is minimal,
- it must be queried against the other minimal
elements - Total number of queries required is at least
n(w-1)/2 - factor of 2 is artifact of the proof?
43note on transitive relations
- Reachability relation in a general di-graph
- may be reflexive
- example protein network
- vertices are proteins
- edge (u, v) , change in concentration of u
directly influences change in concentration of v - v reachable from u , change in concentration of u
indirectly influences concentration of v - For certain questions, our results can be
generalized to transitive relations
44poset mergesort example
45poset mergesort example
46poset mergesort example
47sorted poset
48peeling algorithm
- Given decomposition C1,, Cq with q gt w on m
elements - let S ?i x x is largest elt of Ci
- repeat if there exist x, y 2 S such that y  x
- peel y ( remove it from S ), add child of y in
its chain to S - record (x, y), i.e. that x dislodged y
- if y is last element in its chain, break
- find a subsequence (x1, y1) (xt, yt) of records
- that shows how to rearrange chains
- chains decremented by 1
- O(qm) time required for 1 iteration
- O(q 2m) time required to reduce from 2w to w
chains
49total order data structure
- Given element x and sorted set T
- relations of x to all elements in T can be
determined by finding - the smallest element y 2 T such that y gt x
y
x
T
50total order data structure
- Given element x and sorted set T
- relations of x to all elements in T can be
determined by finding - the smallest element y 2 T such that y gt x
y
x
T x
51figs
a
c
b
d
f
e
52poset mergesort
53poset mergesort
54figs
2
1
0
2
1