VOOZH about

URL: https://www.geeksforgeeks.org/dsa/partial-order-relation-on-a-set/

⇱ Partial Order Relation on a Set - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Partial Order Relation on a Set

Last Updated : 3 Feb, 2023

A relation is a subset of the cartesian product of a set with another set. A relation contains ordered pairs of elements of the set it is defined on.

What is a Partial Order Relation?

A relation R on a set A is called a partial order relation if it is

  1. Reflexive Relation: (a, a) ∈ R ∀ a ∈ A, i.e. aRa for all a ∈ A.
  2. Anti-Symmetric Relation: ∀ a, b ∈ A, (a, b) ∈ R then (b, a) ∉ R OR a = b.
  3. Transitive Relation: ∀ a, b, c ∈ A, if (a, b) ∈ R and (b, c) ∈ R then (a, c) ∈ R.

where R is a subset of (A x A), i.e. the cartesian product of set A with itself.

Example:

Consider set A = {a, b}
R = {(a, a), (b, b), (a, b), (b, a)} is not partial order as for tuple (a, b), (b, a) tuple is present but
R = {(a, a), (a, b), (b, b)} is a partial order relation.

Properties of Partial Order Relation:

The few properties of a partial order relation are:

  • Empty relation on a non-empty set is never partial order.
  • Universal relation over a non-empty set is never a partial order.
  • The smallest partial-order relation will only contain aRa tuples.

How to verify a Partial Order Relation?

The process of identifying/verifying if any given relation is a partial order relation is:

  • Check if the relation is Reflexive.
  • Check if the relation is Anti-Symmetric.
  • Check if the relation is Transitive.

Follow the below illustration for a better understanding

Illustration:

Consider set R = {(1, 1), (1, 3), (1, 4), (2, 2), (2, 1), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4), (4, 3)}

Pairs (1, 1), (2, 2), (3, 3), (4, 4) exist:
    ⇒ This satisfies the reflexive condition.

The transitive condition is also satisfied.

For the pairs (4, 3):
    ⇒ The relation (3, 4) exists
    ⇒ This does not satisfy the anti-symmetric condition.
So the relation is not anti-symmetric.

Hence it is not a partial order relation.

Below is the code for checking if a given relation is partial order relation or not:


Output
Not a Partial Order Relation

Time Complexity:  O(N * K * log N) where N is the number of tuples in relation and K is the maximum number of tuples (a, b) for which a is the same.
Auxiliary Space: O(N)

Comment