Module I Automata Theory and Formal Languages - Lesson 2: Relations and Graphs

Fundamental Concepts of Relations

  • A binary relation is categorized as a set of pairs.

  • The structure of a relation involves two primary components:

    • Domain: This is the set from which the first component of each pair in the relation is chosen.

    • Range: This is the set from which the second component of each pair in the relation is chosen.

  • Formal Definition:

    • Let AA and BB be non-empty sets.

    • A relation RR from AA to BB is defined as a subset of the Cartesian product A×BA \times B.

    • This is mathematically expressed as RA×BR \subseteq A \times B.

    • In this specific context, AA serves as the domain and BB serves as the range.

  • Notation of Membership:

    • If RA×BR \subseteq A \times B and the pair (a,b)(a, b) is an element of RR ((a,b)R(a, b) \in R), the relationship is written as aRbaRb.

    • If the pair is not an element of the relation, it is noted that aa is not related to bb.

  • Relations on a Single Set:

    • It is frequent for the sets AA and BB to be equal (A=BA = B).

    • When RA×AR \subseteq A \times A, it is referred to as a relation on AA.

Mathematical Examples of Relations

  • Example 1: The "Less Than" Relation:

    • Consider sets A={1,2,3,4,5}A = \{1, 2, 3, 4, 5\} and B={1,2,3,4,5}B = \{1, 2, 3, 4, 5\}.

    • Define the relation RR (less than) on AA such that aRbaRb if and only if a < b.

    • The resulting set is: R={(1,2),(1,3),(1,4),(1,5),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5)}R = \{(1, 2), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5)\}.

    • Logic: In the pair (a,b)(a, b), aa represents elements in set AA and bb represents elements in set BB. For instance, (1,2)(1, 2) is valid because 11 (from set AA) is less than 22 (from set BB). This logic applies to every element in the set RR.

  • Example 2: The "Multiple Of" Relation:

    • Let A={1,2,3,4,6}A = \{1, 2, 3, 4, 6\}.

    • Define the relation RR such that aRbaRb if and only if bb is a multiple of aa.

    • The resulting set is: R={(1,1),(1,2),(1,3),(1,4),(1,6),(2,2),(2,4),(2,6),(3,3),(3,6),(4,4),(6,6)}R = \{(1, 1), (1, 2), (1, 3), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6), (3, 3), (3, 6), (4, 4), (6, 6)\}.

Mathematical Symbols and Notation Summary

  • {}\{ \}: Denotes a set.

  • \subseteq: Denotes a subset.

  • A×BA \times B: Denotes a Cartesian product.

  • RR: Denotes a relation.

  • \in: Denotes "is an element of."

  • GG: Denotes a graph.

Theory of Undirected Graphs

  • An undirected graph (referred to simply as a graph) is denoted by G=(V,E)G = (V, E).

  • Components of a Graph:

    • Nodes or Vertices (V): These are the points within the graph.

    • Edges (E): These are the lines that connect specific pairs of points.

  • Node Degree in Undirected Graphs:

    • The degree of a node is defined as the total number of edges connected to that particular node.

    • The order of vertices in an edge pair does not matter in an undirected graph (i.e., the pair (i,j)(i, j) is equivalent to (j,i)(j, i)).

  • Formal Description Examples:

    • Example Graph 1:

      • Description: ({1,2,3},{{1,2},{2,3},{1,3}})( \{1, 2, 3\}, \{ \{1, 2\}, \{2, 3\}, \{1, 3\} \} ).

      • Analysis: Every node has a degree of 2. Node 1 has edges to nodes 2 and 3; node 2 has edges to nodes 1 and 3; and node 3 has edges to nodes 1 and 2.

    • Example Graph 2:

      • Description: ({1,2,3,4},{{1,2},{1,3},{1,4},{2,3},{2,4},{3,4}})( \{1, 2, 3, 4\}, \{ \{1, 2\}, \{1, 3\}, \{1, 4\}, \{2, 3\}, \{2, 4\}, \{3, 4\} \} ).

      • Analysis: Nodes 1 and 4 possess a degree of 3. Nodes 2 and 3 possess a degree of 2.

Theory of Directed Graphs (Digraphs)

  • A graph that utilizes arrows instead of simple lines to indicate direction is known as a directed graph, or digraph.

  • Formal Definition of a Digraph:

    • A digraph is denoted as G=(V,E)G = (V, E).

    • It consists of a finite set of vertices VV.

    • It contains a set of ordered pairs of vertices called edges EE.

  • Degrees in Directed Graphs:

    • Outdegree: The total number of arrows (edges) pointing away from a specific node.

    • Indegree: The total number of arrows (edges) pointing toward a specific node.

  • Digraph Example 1:

    • Formal Description: ({1,2,3,4,5},{(1,2),(1,3),(3,4),(3,5),(4,2),(4,3),(5,4)})( \{1, 2, 3, 4, 5\}, \{(1, 2), (1, 3), (3, 4), (3, 5), (4, 2), (4, 3), (5, 4)\} ).

    • Data points: The outdegree of node 5 is 1. The indegree of node 4 is 2.

  • Digraph Example 2: Relation to Digraph Mapping:

    • Let sets A={1,2,3,4}A = \{1, 2, 3, 4\} and B={1,2,3,4}B = \{1, 2, 3, 4\}.

    • Let the relation RR be defined as: R={(1,1),(1,2),(2,1),(2,2),(2,3),(2,4),(3,4),(4,1)}R = \{(1, 1), (1, 2), (2, 1), (2, 2), (2, 3), (2, 4), (3, 4), (4, 1)\}.

    • This relation can be represented as a digraph where each ordered pair in RR constitutes a directed edge from the first element to the second element.