partial ordering

31
Partial Ordering Lecture 11: Oct 17 (based on slides in MIT 6.042)

Upload: anthea

Post on 07-Jan-2016

55 views

Category:

Documents


2 download

DESCRIPTION

Partial Ordering. Lecture 11: Oct 17. (based on slides in MIT 6.042). Representing Relations as Graphs. Given a set A, a binary relation R on A is a subset of pairs of A. For example, in a social network, the set A = set of people. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Partial Ordering

Partial Ordering

Lecture 11: Oct 17 (based on slides in MIT 6.042)

Page 2: Partial Ordering

Representing Relations as Graphs

Given a set A, a binary relation R on A is a subset of pairs of A.

For example, in a social network, the set A = set of people.

John

relation R = friendship, which is a symmetric relationship.

Mary

Tom

DavidSam

A symmetric relationship can be represented by an

undirected graph.

Page 3: Partial Ordering

For equivalence relationship, the graph has a special structure.

Equivalence Relationship

For example, let A = set of positive integers, and

relationship R be “the same remainder when divided by 3”.

1

4

7

2

5

8

3

6

9

Each connected component is a complete subgraph.

Page 4: Partial Ordering

Asymmetric relations is represented by a directed graph.

Asymmetric Relationship

Miami

Chicago

LA

BostonNew York

For example, set A = set of basketball teams

relation R = whether team a beats team b

The resulting directed graph has no special structure.

Page 5: Partial Ordering

Asymmetric “Ordering” Relationship

For some asymmetric relations, there is an “ordering” between the objects.

For example, the set A = all subsets of {x,y,z},

the relation R = whether X is a proper subset of Y

• Asymmetry

• Transitivity

No directed cycles.

Page 6: Partial Ordering

Partial Order

A partial order is a binary relation which satisfies the following properties.

(1) Asymmetry: aRb implies (bRa) for all a,b A

(2) Transitivity: aRb and bRc implies aRc for all a,b,c A.

a

b

a

b

c

Page 7: Partial Ordering

Example of Partial Order

Directed graph representation Partial order representation

When there is a directed path from X to Y, it is

understood that it implies there is a relation (X,Y) by

transitivity.

Page 8: Partial Ordering

Example of Partial Order

Directed graph representation Partial order representation

1

2

3

4

1

2

3

4

Let A = set of positive integers

relation R = “is less than”

Page 9: Partial Ordering

a divides b iff ka = b for some k

2

10

3 5

15

30

More Example: Divide

Page 10: Partial Ordering

1 {1}

2 {1,2}

3 {1,3}

5 {1,5}

15{1,3,5,15}

10 {1,2,5,10}

30 {1,2,3,5,10,15,30}

Subset from Divide

The divide relation

can also be captured

by the subset relation.

Page 11: Partial Ordering

Definition. A binary relation, R, on set A,

is a strict partial order iff

it is transitive and

asymmetric.

Strict Partial Order

In a strict partial ordering, can we have aRa?

Weak partial order is the same as

strict partial order except

aRa for all a A (reflexivity)

NO, because of asymmetry.

e.g. “less than equal”,

“subset”, etc.

Page 12: Partial Ordering

Total Order

Definition. A pair (a,b) is incomparable if neither aRb nor bRa

A total order is a partial order with no incomparable pairs.

That is, in a total order,

either aRb or bRa for all ab A

e.g. ({x,y},{y,z}) is incomparable,

({x},{z}) is incomparable, etc.

Page 13: Partial Ordering

1. ≤ on the Integers

2. < on the Reals

3. on Sets (subset)

4. on Sets (proper subset)

5. Divide

6. Properly divide

Some Partial Orders

Which are total?

Which are strict?

1,2

2,4,6

Page 14: Partial Ordering

subject c is a direct prerequisite for subject d

c→d

Subject Prerequisites

18.01 → 6.042 → 6.046 → 6.840

18.01 is indirect prereq. of 6.840

18.01 → 6.042 → 6.046 → 6.840

To find a feasible ordering of the courses

we need to start with a course with no prerequisite.

Partial order representation.

Directed graph representation.

Page 15: Partial Ordering

d is minimal: no “smaller” element

d is minimum: d is “smaller” than everything

. ( )c d c d

.c d d c

Minimal vs Minimum

minimum means "smallest” – a prereq. for every subject

Page 16: Partial Ordering

Directed Acyclic Graph

Does a partial order always have a minimal element?

18.01 → 6.042 → 6.046 → 6.840

The directed graph representation of a partial order is a directed acyclic graph.

violate asymmetry

A directed cycle wouldDirected graph representation.

Page 17: Partial Ordering

Existence of a Minimal Element

What is a minimal element in the directed acyclic graph?

A vertex with indegree zero.

Does a directed acyclic graph always have an indegree zero vertex?

Start from any vertex v. Always go backward.

Since there is no directed cycle,

there must be a indegree zero vertex.

Fact. There is a vertex with indegree zero in a directed acyclic graph.

Fact. There is a minimal element in a partial order.

Does a partial order always have a minimal element?

v

Page 18: Partial Ordering

18.02

18.01

6.046

6.840

18.03

6.001

6.034

6.003

8.01

8.02

6.002

6.004

6.033

6.857

6.042

Course Schedule

Partial order representation.

Page 19: Partial Ordering

Antichain: Set of subjects with no prereqs among them

-- can be taken in any order. (said to be incomparable)

Antichain

In the directed graph representation, an antichain corresponds

to a set of vertices with no edges between them.

Page 20: Partial Ordering

18.02

18.01

6.046

6.840

18.03

6.001

6.034

6.003

8.01

8.02

6.002

6.004

6.033

6.857

6.042

may have other

antichains

Some Antichains

Page 21: Partial Ordering

Chain: Set of successive prereqs

-- must be taken in order.

(subjects said to be comparable)

Chain

In the directed graph representation,

a chain corresponds to a directed path.

Page 22: Partial Ordering

18.02

18.01

6.046

6.840

18.03

6.001

6.034

6.003

8.01

8.02

6.002

6.004

6.033

6.857

6.042

Some Chains

Page 23: Partial Ordering

18.02

18.01

6.046

6.840

18.03

6.001

6.034

6.003

8.01

8.02

6.002

6.004

6.033

6.857

6.042

Maximum Length Chain

also known as a critical pathHow many terms to graduate?

6 terms are necessary

Page 24: Partial Ordering

and sufficient (but may need to take many courses per term...)

18.02

18.01

6.046

6.840

18.03

6.001

6.034

6.003

8.01

8.02

6.002

6.004

6.033

6.857

6.042

Minimum Length Schedule

Finding minimum schedule =

Partition into minimum

number of antichains

Page 25: Partial Ordering

Graph Colouring

minimum length schedule >= maximum length chain

Can we always find a schedule with length = maximum length chain?

This is a graph colouring problem.

Minimum colouring

Maximum path length

In the directed graph representation, an antichain corresponds

to a set of vertices with no edges between them.

An antichain can be

coloured by the same

colour

Page 26: Partial Ordering

Graph Colouring

Theorem. In a directed acyclic graph,

minimum colouring <= maximum path length.

1. Let k be the maximum path length in G.

2. Let M be the set of vertices with indegree 0.

3. Consider G-M.

4. The maximum path length in G-M is k-1.

5. By induction, G-M can be coloured using k-1 colours.

6. Use a new colour for vertices in M.

7. We are done.

M

G-M

Corollary. Every partial ordering can be partitioned into k antichains,

where k is equal to the maximum chain length.

Page 27: Partial Ordering

Dilworth’s Theorem

Dilworth’s Theorem. For all t > 0, every partially

ordered set with n elements must have either a chain

of size greater than t or an antichain of size at least

n/t.

Corollary. Every partial ordering can be partitioned into k antichains,

where k is equal to the maximum chain length.

(Proof of Dilworth’s theorem)

1. If the maximum chain length is at most t,

2. then the partial ordering can be partitioned into t antichains.

3. Therefore, there is an antichain with at least n/t elements.

Page 28: Partial Ordering

Application of Dilworth’s Theorem

For example, if S = (6, 4, 7, 9, 1, 2, 5, 3, 8),

then 647 and 7253 are both subsequences of S.

An increasing subsequence of S is a subsequence

of whose successive elements get larger;

A decreasing subsequence is defined similarly.

Let S be a sequence of n different numbers.

A subsequence of S is a sequence that

can be obtained by deleting elements of S.

A longest increasing subsequence is 1238,

and a longest decreasing subsequence is 641.

Page 29: Partial Ordering

Application of Dilworth’s Theorem

Can you find a sequence of 9 numbers with

no increasing subsequence of length 4 and

no deceasing subsequence of length 4?

3, 2, 1, 6, 5, 4, 9, 8, 7

Can you do better?

Claim. For any sequence of 9 numbers,

there must be an increasing sequence of length 3,

or a decreasing sequence of length 3.

Page 30: Partial Ordering

Claim. For any sequence of 9 numbers,

there must be an increasing sequence of length 3,

or a decreasing sequence of length 3.

Application of Dilworth’s Theorem

Given any sequence a1, a2,…, a9

Define a partial ordering as follow.

ai aj iff i < j and ai < aj

6 4 7 9 1 2 5 3 8

Page 31: Partial Ordering

•A chain = a path = an increasing subsequence.

•An antichain = a set of vertices with no edges = a decreasing

subsequence.

Dilworth’s Theorem. For all t > 0, every partially

ordered set with n elements must have either a chain

of size greater than t or an antichain of size at least

n/t.

Application of Dilworth’s Theorem

6 4 7 9 1 2 5 3 8