370 likes | 719 Views
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.
E N D
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. relation R = friendship, which is a symmetric relationship. A symmetric relationship can be represented by an undirected graph. Mary Tom John David Sam
Equivalence Relationship For equivalence relationship, the graph has a special structure. For example, let A = set of positive integers, and relationship R be “the same remainder when divided by 3”. Each connected component is a complete subgraph. 1 2 3 4 5 6 7 8 9
Asymmetric Relationship Asymmetric relations is represented by a directed graph. For example, set A = set of basketball teams relation R = whether team a beats team b The resulting directed graph has no special structure. Chicago LA Miami Boston New York
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.
Partial Order A partial order is a binary relation which satisfies the following properties. a (1) Asymmetry: aRb implies (bRa) for all a,b A (2) Transitivity: aRband bRc implies aRc for all a,b,c A. b a b c
Example of Partial Order When there is a directed path from X to Y, it is understood that it implies there is a relation (X,Y) by transitivity. Partial order representation Directed graph representation
Example of Partial Order Let A = set of positive integers relation R = “is less than” 1 1 2 2 3 3 4 4 Partial order representation Directed graph representation
30 10 15 3 5 More Example: Divide 2 adividesb iff ka = b for some k
30 {1,2,3,5,10,15,30} 10 {1,2,5,10} 2 {1,2} 5 {1,5} Subset from Divide 15{1,3,5,15} 3 {1,3} The divide relation can also be captured by the subset relation. 1 {1}
Strict Partial Order Definition. A binary relation, R, on set A, is a strict partial order iff it is transitive and asymmetric. In a strict partial ordering, can we have aRa? NO, because of asymmetry. Weak partial order is the same as strict partial order except aRa for all a A(reflexivity) e.g. “less than equal”, “subset”, etc.
Total Order Definition. A pair (a,b) is incomparable if neither aRb nor bRa e.g. ({x,y},{y,z}) is incomparable, ({x},{z}) is incomparable, etc. 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
Some Partial Orders • ≤ on the Integers • < on the Reals • on Sets (subset) • on Sets (proper subset) • Divide • Properly divide Which are total? 1,2 2,4,6 Which are strict?
Subject Prerequisites subject c is a direct prerequisite for subject d c→d 18.01 → 6.042 → 6.046 → 6.840 Partial order representation. Directed graph representation. 18.01 →6.042 → 6.046 → 6.840 18.01 is indirect prereq. of 6.840 To find a feasible ordering of the courses we need to start with a course with no prerequisite.
Minimal vs Minimum d is minimal: no “smaller” element d is minimum: d is “smaller” than everything minimummeans "smallest” – a prereq. for every subject
Directed Acyclic Graph Does a partial order always have a minimal element? 18.01 →6.042 → 6.046 → 6.840 A directed cycle would Directed graph representation. violate asymmetry The directed graph representation of a partial order is a directed acyclic graph.
Existence of a Minimal Element Does a partial order always have 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. v Fact. There is a vertex with indegree zero in a directed acyclic graph. Fact. There is a minimal element in a partial order.
Course Schedule 18.01 8.01 6.001 18.02 6.042 18.03 8.02 6.034 6.046 6.002 6.840 6.004 6.003 6.033 Partial order representation. 6.857
Antichain Antichain: Set of subjects withno prereqs among them -- can be taken in any order. (said to be incomparable) In the directed graph representation, an antichain corresponds to a set of vertices with no edges between them.
Some Antichains 18.01 8.01 6.001 18.02 6.042 18.03 8.02 6.034 6.046 6.002 6.840 6.004 6.003 6.033 may have other antichains 6.857
Chain Chain: Set of successive prereqs -- must be taken in order. (subjects said to be comparable) In the directed graph representation, a chain corresponds to a directed path.
Some Chains 18.01 8.01 6.001 18.02 6.042 18.03 8.02 6.034 6.046 6.002 6.840 6.004 6.003 6.033 6.857
Maximum Length Chain 18.01 8.01 6.001 18.02 6.042 18.03 8.02 6.034 6.046 6.002 6.840 6.004 6.003 6.033 How many terms to graduate? also known as a critical path 6 terms are necessary 6.857
Minimum Length Schedule andsufficient(but may need to take many courses per term...) 18.01 8.01 6.001 18.02 6.042 18.03 8.02 6.034 6.046 6.002 6.840 6.004 6.003 Finding minimum schedule = Partition into minimum number of antichains 6.033 6.857
Graph Colouring Maximum path length Minimum colouring minimum length schedule >= maximum length chain Can we always find a schedule with length = maximum length chain? This is a graph colouring problem. 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
Graph Colouring Theorem. In a directed acyclic graph, minimum colouring <= maximum path length. M • Let k be the maximum path length in G. • Let M be the set of vertices with indegree 0. • Consider G-M. • The maximum path length in G-M is k-1. • By induction, G-M can be coloured using k-1 colours. • Use a new colour for vertices in M. • We are done. G-M Corollary. Every partial ordering can be partitioned into k antichains, where k is equal to the maximum chain length.
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) • If the maximum chain length is at most t, • then the partial ordering can be partitioned into t antichains. • Therefore, there is an antichain with at least n/t elements.
Application of Dilworth’s Theorem 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. 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. A longest increasing subsequence is 1238, and a longest decreasing subsequence is 641.
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.
Application of Dilworth’s Theorem Claim. For any sequence of 9 numbers, there must be an increasing sequence of length 3, or a decreasing sequence of length 3. Given any sequence a1, a2,…, a9 Define a partial ordering as follow. ai aj iff i < j and ai < aj 6 9 1 2 5 3 8 4 7
Application of Dilworth’s Theorem 6 9 1 2 5 3 8 4 7 • 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.