BCA151 Discrete Structure

Discrete StructureUnit 38 min read

Relations & Partial Orders: Definitions, Properties & Applications

Unit 3 of Discrete Structure explores relations (reflexive, symmetric, transitive, equivalence), partial orders (Hasse diagrams, chains, antichains), and their real-world uses in databases, social networks, and scheduling—with visual proofs and exam-focused examples.

TAKEAWAYS:

  • A relation is a subset of that can be reflexive, symmetric, transitive, or an equivalence relation (partitioning sets into equivalence classes).
  • Partial orders (like divisibility or subset relations) are reflexive, antisymmetric, and transitive, visualized via Hasse diagrams to show minimal/maximal elements.
  • Equivalence relations partition sets into disjoint equivalence classes, used in hashing (e.g., modulo operations in Khalti’s transaction IDs).
  • Closures (reflexive, symmetric, transitive) extend relations to satisfy properties, critical for designing error-free algorithms (e.g., Pathao’s route optimization).
  • Applications: Social networks (friendship relations), databases (foreign keys), and scheduling (task dependencies) rely on these structures.
  • Exam focus: Prove properties, draw Hasse diagrams, and compute closures—always justify steps with definitions.

1. Relations: Definitions and Properties

A relation from set to set is a subset of the Cartesian product . If , we write . Relations can be represented as:

  • Directed graphs (nodes = elements, edges = relations),
  • Matrices (rows/columns = elements, entries = 1 if related, 0 otherwise),
  • Sets of ordered pairs (e.g., ).

Key Properties of Relations

Relations on a set (i.e., ) can have these properties:

Property Definition Example (for , )
Reflexive Fails: . Fix: Add .
Symmetric If , then Fails: but ? No—it passes here.
Transitive If and , then Fails if and were in but .
Antisymmetric If and , then Always true here (no distinct pairs and exist).

Equivalence Relations

A relation that is reflexive, symmetric, and transitive is an equivalence relation. It partitions into equivalence classes (disjoint subsets where all elements are related).

Example: Let and if .

  • Proof:
    1. Reflexive: (always true).
    2. Symmetric: If , then .
    3. Transitive: If and , then .
  • Equivalence classes: .

Real-world tie-in: Khalti assigns transaction IDs modulo 1000 to group similar transactions (e.g., all IDs ending with 001 are equivalent for fraud detection). This uses equivalence relations to cluster data efficiently.


2. Partial Orders and Hasse Diagrams

A partial order is a relation that is reflexive, antisymmetric, and transitive. Notation: where is the partial order.

UAB1, 2, 4, 83, 6, 12, 24
Example of two chains in divisibility order (A and B)

Key Concepts

  • Hasse Diagram: A simplified directed acyclic graph (DAG) where:
    • Nodes = elements of ,
    • Edges = relations if (no transitive edges or reflexive loops).
  • Minimal/Maximal Elements:
    • Minimal: No element is related to it (except itself).
    • Least/Greatest: Unique minimal/maximal element related to all others.
  • Chains/Antichains:
    • Chain: Totally ordered subset (e.g., ).
    • Antichain: No two elements are comparable (e.g., in divisibility order).

Example: Let with if divides .

  • Hasse Diagram:
    graph TD
      A["1"] --> B["2"]
      A --> C["3"]
      B --> D["6"]
      C --> D
  • Minimal element: 1 (divides all others).
  • Maximal element: 6 (no element divides it except itself).
  • Chains: , .
  • Antichain: (neither divides the other).

Real-world tie-in: Daraz’s order processing uses partial orders to prioritize tasks:

  • Orders are nodes, and "task A must complete before task B" defines edges.
  • A Hasse diagram helps visualize dependencies (e.g., payment processing inventory check shipping).

3. Closures of Relations

Given a relation , its closure is the smallest relation containing that satisfies a property (reflexive, symmetric, transitive).

Closure Type Definition Example (for on )
Reflexive Add .
Symmetric Add .
Transitive Add .

Algorithm for Transitive Closure (Warshall’s):

  1. Initialize .
  2. For each :
    • If and , add to .
  3. Repeat until no new pairs are added.

Real-world tie-in: NTC’s network routing uses transitive closure to precompute all possible paths between nodes. If path and exist, the network knows is possible without recalculating.


4. Applications in Computer Science

Application Relation Type Example
Databases Foreign key constraints Student Course (enrollment relation must be transitive).
Social Networks Friendship (symmetric) If Alice is friends with Bob, Bob is friends with Alice.
Compilers Operator precedence Partial order defines evaluation order (e.g., * before +).
Operating Systems Process dependencies Process A must finish before Process B starts (partial order).
Cryptography Equivalence classes Modular arithmetic groups messages into equivalence classes.

Exam Tip

  1. Prove properties: For equivalence relations, explicitly check reflexivity, symmetry, and transitivity. Use bullet points or tables like above.
  2. Draw Hasse diagrams: Always omit reflexive loops and transitive edges. Label minimal/maximal elements clearly.
  3. Closures: Show step-by-step additions to the relation. For transitive closure, use Warshall’s algorithm or list all implied pairs.
  4. Real-world links: In proofs, tie examples to systems like Khalti (equivalence), Daraz (partial orders), or NTC (transitive closure).
  5. Common pitfalls:
    • Forgetting to include all elements in reflexive closure.
    • Misidentifying antisymmetry (e.g., confusing it with asymmetry).
    • Skipping the "disjoint" requirement for equivalence classes.

Worked Example (Exam Style): Question: Let and . Is a partial order? If not, find its transitive closure.

Solution:

  1. Check properties:
    • Reflexive: Fails (missing ).
    • Antisymmetric: Passes (no pairs and with ).
    • Transitive: Fails (missing because and exist).
  2. Transitive closure: Add . Final .
  3. Hasse Diagram:
    graph TD
      A["1"] --> B["2"]
      A --> D["4"]
      C["3"] --> D
    • Minimal elements: 1, 3.
    • Maximal element: 4.

Why this matters: This mirrors how Pathao’s ride-matching algorithm ensures no circular dependencies in task scheduling (e.g., "pickup" must precede "drop-off"). The transitive closure guarantees all implied dependencies are accounted for.

Based on the TU BCA syllabus for Discrete Structure (BCA151), unit 3.

Discussion

Loading…