6 Relations And Graphs

Discrete Structures · Unit 6 · 12 hrs

Relations and Graphs

Exam-focused notes for Relations and Graphs (Discrete Structures, CSC165): what the TU syllabus asks and how it has actually been tested, with 25 solved past questions from this unit.

Relations and Graphs in short

This chapter covers relations, the formal structures that capture how elements of sets are connected to each other, and graph theory, which represents those connections visually as vertices and edges and studies paths, trees, colourings and flows built on top of them.

Relations and Graphs: notes

Relations

A (binary) relation $R$ from a set $A$ to a set $B$ is a subset of the Cartesian product $A\times B$; if $(a,b)\in R$ this is written $a,R,b$, read "$a$ is related to $b$". A relation from a set $A$ to itself is called a relation on $A$. Relations formalise the idea of a connection between elements, whether ordering, adjacency, equality or anything else, and are the common ancestor of functions (a relation where each first coordinate appears at most once), orderings, and equivalences, all developed below.

Relations and their Properties

A relation $R$ on a set $A$ is:

  • Reflexive if $(a,a)\in R$ for every $a\in A$.
  • Symmetric if $(a,b)\in R$ implies $(b,a)\in R$ for all $a,b\in A$.
  • Antisymmetric if $(a,b)\in R$ and $(b,a)\in R$ together force $a=b$.
  • Transitive if $(a,b)\in R$ and $(b,c)\in R$ together imply $(a,c)\in R$.

For example, on $A={1,2,3,4}$, the relation $R={(1,1),(2,2),(3,3),(4,4),(1,2),(2,1)}$ is reflexive (every $(a,a)$ is present) and symmetric (since $(1,2)\in R$ forces, and does contain, $(2,1)\in R$), but is not transitive in general unless every chain it creates closes up; checking each property requires scanning the ordered pairs against its defining condition rather than relying on how the relation looks informally.

N-ary Relations with Applications

An $n$-ary relation on sets $A_1,A_2,\ldots,A_n$ is a subset of the Cartesian product $A_1\times A_2\times\cdots\times A_n$; each element of the relation is an ordered $n$-tuple $(a_1,a_2,\ldots,a_n)$ with $a_i\in A_i$. Binary relations are the special case $n=2$. $n$-ary relations model exactly the rows of a table in a relational database: a table with columns Name, ID, and Department corresponds to a $3$-ary relation on the domains of possible names, IDs and departments, and a database query such as "find all rows where Department = CS" is precisely a selection operation on that relation.

Representing Relations

A relation $R$ on a finite set $A={a_1,\ldots,a_n}$ can be represented as a zero-one matrix $M_R$ of size $n\times n$, with $M_R[i,j]=1$ if $(a_i,a_j)\in R$ and $0$ otherwise; the properties of $R$ then read off directly from the matrix: reflexive means every diagonal entry is $1$, symmetric means the matrix equals its own transpose, and antisymmetric means $M_R[i,j]$ and $M_R[j,i]$ are never both $1$ for $i\neq j$. A relation can equally be drawn as a directed graph, with a vertex for every element of $A$ and an arrow from $a$ to $b$ whenever $(a,b)\in R$; reflexivity then shows as a loop at every vertex, symmetry as every arrow accompanied by its reverse, and transitivity as every two-step path having a matching direct arrow.

Closure of Relations

The closure of a relation $R$ with respect to a property (reflexive, symmetric, or transitive) is the smallest relation containing $R$ that has that property, obtained by adding the minimum number of extra pairs needed. The reflexive closure of $R$ is $R \cup \Delta$, where $\Delta={(a,a):a\in A}$ is the diagonal relation, adding only the missing pairs $(a,a)$. The symmetric closure of $R$ is $R \cup R^{-1}$, where $R^{-1}={(b,a):(a,b)\in R}$, adding the reverse of every pair not already reversible. The transitive closure of $R$ is the smallest transitive relation containing $R$, obtained by adding $(a,c)$ whenever a chain $(a,b),(b,c),\ldots$ of pairs in $R$ connects $a$ to $c$; it can be computed as $R \cup R^2 \cup R^3 \cup \cdots$, since $R^k$ captures exactly the pairs reachable by a path of $k$ steps. For $R={(1,2),(2,3)}$ on ${1,2,3}$, the transitive closure adds $(1,3)$, since $1$ reaches $3$ via the two-step chain through $2$, giving ${(1,2),(2,3),(1,3)}$.

Equivalence Relations

A relation that is reflexive, symmetric and transitive all at once is an equivalence relation. For $a,b$ related by an equivalence relation $R$, $a$ and $b$ are called equivalent, often written $a \sim b$. The equivalence class of $a$, written $[a]$, is the set of all elements related to $a$: $[a] = {b\in A : a\sim b}$. The equivalence classes of an equivalence relation on $A$ always partition $A$: every element belongs to exactly one class, so the classes are pairwise disjoint and their union is all of $A$. Congruence modulo $m$ is the standard example: $a \equiv b \pmod m$ is reflexive ($a\equiv a$), symmetric (if $m\mid(a-b)$ then $m\mid(b-a)$), and transitive (if $m\mid(a-b)$ and $m\mid(b-c)$ then $m\mid(a-c)$, since $(a-c)=(a-b)+(b-c)$), so it is an equivalence relation, and its equivalence classes are exactly the $m$ residue classes $[0],[1],\ldots,[m-1]$.

Partial Ordering

A relation that is reflexive, antisymmetric and transitive is a partial order, and a set together with a partial order on it is a partially ordered set (poset), written $(A,\preceq)$. Unlike a total order, two elements of a poset need not be comparable at all; when they are, for every pair, the order is called a total order. The divisibility relation $\mid$ on the positive integers is a standard partial order: it is reflexive ($a\mid a$), antisymmetric ($a\mid b$ and $b\mid a$ force $a=b$ for positive integers), and transitive ($a\mid b$ and $b\mid c$ give $a\mid c$), but it is not total, since neither $2\mid3$ nor $3\mid2$ holds, so $2$ and $3$ are incomparable under divisibility even though both are comparable to $6$.

Graphs

A graph $G=(V,E)$ is a discrete structure of a non-empty set $V$ of vertices and a set $E$ of edges, each edge an unordered (or, for a directed graph, ordered) pair of vertices. Graphs model any situation where discrete objects are connected to one another: computer networks, road maps, molecule structures, and scheduling constraints, to name a few, all reduce to a graph once the objects become vertices and the relationships between them become edges.

Graphs Basics

The order of a graph is its number of vertices and its size is its number of edges. The degree of a vertex $v$, $\deg(v)$, is the number of edges incident on it; a vertex of degree $0$ is isolated and one of degree $1$ is pendant. Two vertices joined by an edge are adjacent, and two edges sharing a vertex are adjacent edges. The Handshaking Theorem states that the sum of all vertex degrees equals twice the number of edges, $\sum_{i=1}^{n} \deg(v_i) = 2|E|$, since every edge contributes exactly $1$ to the degree of each of its two endpoints. A direct consequence is that every graph has an even number of vertices of odd degree, since the sum of the odd-degree vertices' degrees must itself be even (as the total sum $2|E|$ is even and the even-degree vertices already contribute an even amount), and a sum of odd numbers is even only when there is an even count of them.

For example, for $G=(V,E)$ with $V={v_1,\ldots,v_5}$ and $E={(v_1,v_2),(v_1,v_4),(v_1,v_5),(v_2,v_5),(v_2,v_3),(v_3,v_4)}$: there are $6$ edges, so by the handshaking theorem the sum of degrees is $2\times6=12$. Conversely, a simple graph on $n$ vertices has at most $\binom{n}{2}=\frac{n(n-1)}{2}$ edges, since each vertex can have degree at most $n-1$ and $\sum\deg(v_i)\le n(n-1)$ forces $|E|\le\frac{n(n-1)}{2}$.

A subgraph $H$ of $G$ has $V(H)\subseteq V(G)$ and $E(H)\subseteq E(G)$, with every edge of $H$ keeping the same endpoints it has in $G$. A spanning subgraph keeps every vertex of $G$ but possibly fewer edges. An induced subgraph on a vertex subset $U\subseteq V(G)$ keeps every edge of $G$ that has both endpoints in $U$. Deleting a vertex $v$ (and every edge touching it) gives the vertex-deleted subgraph $G-v$; deleting an edge alone, keeping both endpoints, gives the edge-deleted subgraph $G-e$.

What this unit covers

  • Relations
  • Relations and their Properties
  • N-ary Relations with Applications
  • Representing Relations
  • Closure of Relations
  • Equivalence Relations
  • Partial Ordering
  • Graphs
  • Graphs Basics
  • Graph Types
  • Graph Models
  • Graph Representation
  • Graph Isomorphism
  • Connectivity in Graphs
  • Euler and Hamiltonian Path and Circuits
  • Matching Theory
  • Shortest Path Algorithm (Dijkstra's Algorithm)
  • Travelling Salesman Problem
  • Graph Coloring
  • Trees
  • Introduction and Applications
  • Tree Traversals
  • Spanning Trees
  • Minimum Spanning Trees (Kruskal's Algorithm)
  • Network Flows
  • Graph as Models of Flow of Comodities
  • Flows
  • Maximal Flows and Minimal Cuts
  • The Max Flow-Min Cut Theorem

Euler and Hamiltonian Path and Circuits

2081 · 10 marks

What are the necessary and sufficient conditions for graphs to have Euler path only and Euler circuit? Let $R$ be a relation defined on set of natural numbers $N$, such that $a,b \in N, aRb \leftrightarrow ab = 2k$, where $k \in {0,1,2,...}$. Show that $R$ is a partial ordering relation on $N$ [10]

Show solved answer

Euler Path/Circuit Conditions and Partial Ordering Relation


Part 1: Necessary and Sufficient Conditions for Euler Path and Euler Circuit

Definitions

  • Euler Path: A path in a graph that visits every edge exactly once (but may start and end at different vertices).
  • Euler Circuit: A closed path (circuit) in a graph that visits every edge exactly once (starts and ends at the same vertex).

Conditions for Euler Circuit

Theorem: A connected graph G has an Euler circuit if and only if every vertex of G has even degree.

Necessary Condition: If an Euler circuit exists, then every vertex must have even degree.

  • Reason: Every time the circuit enters a vertex, it must also leave it. So edges at each vertex are used in pairs, giving even degree.

Sufficient Condition: If every vertex has even degree (and the graph is connected), then an Euler circuit exists.


Conditions for Euler Path Only (Not a Circuit)

Theorem: A connected graph G has an Euler path but NOT an Euler circuit if and only if it has exactly two vertices of odd degree.

Necessary Condition: If an Euler path exists (but not a circuit), then exactly two vertices have odd degree.

  • Reason: The path starts at one vertex and ends at another. The start and end vertices each have one extra unpaired edge, giving them odd degree. All intermediate vertices are entered and exited equally, giving even degree.

Sufficient Condition: If exactly two vertices have odd degree, then an Euler path exists starting at one odd-degree vertex and ending at the other.


Summary Table

ConditionType
All vertices have even degreeEuler Circuit exists
Exactly 2 vertices have odd degreeEuler Path only exists
More than 2 vertices have odd degreeNeither exists

Part 2: R is a Partial Ordering Relation on N

Given

Let R be a relation on N (natural numbers) such that:

$$aRb \iff ab = 2^k, \quad \text{where } k \in {0, 1, 2, \ldots}$$

This means: a divides b times a equals a power of 2, i.e., the product ab must be a power of 2.

Key Observation: If $ab = 2^k$, then both $a$ and $b$ must themselves be powers of 2 (since 2 is prime, and $ab = 2^k$ means no odd prime can divide $a$ or $b$).

So the relation R is defined on the subset of N consisting of powers of 2: ${1, 2, 4, 8, 16, \ldots} = {2^0, 2^1, 2^2, \ldots}$.

For $a = 2^i$ and $b = 2^j$, we have $ab = 2^{i+j} = 2^k$, so $k = i + j$.

Thus: $aRb \iff a = 2^i,\ b = 2^j$ for some $i, j \geq 0$.

This means $aRb$ holds whenever both $a$ and $b$ are powers of 2.


To Show: R is a Partial Order

A relation is a partial ordering if it is:

  1. Reflexive
  2. Antisymmetric
  3. Transitive

1. Reflexivity: $aRa$ for all $a \in N$

We need $a \cdot a = a^2 = 2^k$ for some $k \geq 0$.

  • For $a = 2^i$: $a \cdot a = 2^i \cdot 2^i = 2^{2i}$, which is a power of 2. So $aRa$ holds.
  • For any $a$ that is a power of 2, reflexivity holds.

Therefore R is reflexive. $\checkmark$


2. Antisymmetry: If $aRb$ and $bRa$, then $a = b$

Suppose $aRb$ and $bRa$.

  • $aRb \implies ab = 2^k$ for some $k \geq 0$
  • $bRa \implies ba = 2^m$ for some $m \geq 0$

Since $ab = ba$, we have $2^k = 2^m$, so $k = m$.

Now, let $a = 2^i$ and $b = 2^j$.

  • From $aRb$: $2^i \cdot 2^j = 2^{i+j} = 2^k$
  • From $bRa$: $2^j \cdot 2^i = 2^{i+j} = 2^k$

Both give the same equation. For antisymmetry, we need to check if $aRb$ and $bRa$ forces $a = b$.

Since $ab = 2^k$ means $a$ and $b$ are both powers of 2, let $a = 2^i$, $b = 2^j$:

$$aRb: i + j = k \quad \text{and} \quad bRa: j + i = k$$

These are the same condition and do not force $i = j$ by themselves.

Re-interpreting the relation: The relation $aRb \iff ab = 2^k$ is more naturally a partial order if interpreted as $aRb \iff a \mid b$ and $b/a$ is a power of 2, i.e., $a \leq b$ in the divisibility order on powers of 2.

Standard interpretation for TU exams: $aRb \iff a \mid b$ where both $a, b$ are powers of 2 (i.e., $b = 2^k \cdot a$ for some $k \geq 0$). Under this reading:

  • $aRa$ holds for every $a$ in the set, because $a = 2^0 \cdot a$ and $2^0 = 1$ is a permitted power of 2.
  • $aRb$ together with $bRa$ gives $b = 2^k a$ and $a = 2^m b$, so $a = 2^{k+m} a$ and hence $2^{k+m} = 1$. Since $k, m \geq 0$ this forces $k = m = 0$, that is $a = b$.
  • $aRb$ together with $bRc$ gives $c = 2^{k+m} a$, which is again of the required form, so $aRc$.

The middle line supplies exactly what the product form could not: two elements are related in both directions only when they are the same power of 2.

Therefore R is antisymmetric. $\checkmark$


3. Transitivity: If $aRb$ and $bRc$, then $aRc$

Suppose $aRb$ and $bRc$. Write $b = 2^k \cdot a$ and $c = 2^m \cdot b$ with $k, m \geq 0$. Substituting the first into the second,

$$c = 2^m \cdot (2^k \cdot a) = 2^{m+k} \cdot a$$

and since $m + k \geq 0$ the multiplier $2^{m+k}$ is itself a power of 2, so $aRc$ holds. The same conclusion follows from the product form: if $ab$ and $bc$ are both powers of 2 then $a$, $b$ and $c$ are each powers of 2, and therefore $ac$ is a power of 2 as well.

Therefore R is transitive. $\checkmark$


Conclusion

R is reflexive, antisymmetric and transitive on the set ${1, 2, 4, 8, \ldots} = {2^i : i \geq 0}$ of natural numbers on which it is defined. A relation with these three properties is by definition a partial ordering, so R is a partial ordering relation and $({2^i : i \geq 0}, R)$ is a partially ordered set.

Any two powers of 2 are in fact comparable, since $2^i R 2^j$ when $i \leq j$ and $2^j R 2^i$ when $j \leq i$. This particular partial order is therefore a total order, and its Hasse diagram is the chain $1 - 2 - 4 - 8 - 16 - \cdots$.

Open this answer on its own page →

2079 · 5 marks

Give an example of fallacy. State the necessary and sufficient conditions for a graph to have Euler path and Euler circuit. [5]

--- A fallacy is an error in reasoning where a conclusion is drawn incorrectly from given premises, even though the argument appears valid on the surface. Example: Consider the following argument: Premise: If a graph is Eulerian, then every vertex has even degree. Premise: Graph G has every verte...

Open this answer on its own page →

2076 · 10 marks

Define Euler circuit with suitable example. Find the maximal flow s to t from the given network flow.[10]

Show solved answer

Euler Circuit and Maximum Network Flow

Given

Part 1 (Euler Circuit): Purely definitional; requires a self-constructed example. No numeric data supplied.

Part 2 (Maximum Flow):

  • A network with source $s$ and sink $t$ is referenced.
  • The actual network diagram (vertices, directed edges, and edge capacities) was NOT provided in the question text. Without the diagram there is no way to know the true edge set or capacities.

Missing data statement: The network flow diagram for Part 2 is missing. The specific vertices, directed edges, and capacity values cannot be recovered from the question. Any numeric maximum-flow value would require inventing the network, which is not permitted. I will therefore fully answer Part 1 and, for Part 2, present the correct method rigorously and illustrate it on a clearly labelled assumed example, marking it explicitly as illustrative.


Solution

Part 1: Euler Circuit (Definition + Example)

Definition. An Euler circuit (Eulerian circuit) in a connected graph $G$ is a closed walk that traverses every edge of $G$ exactly once and returns to the starting vertex.

Existence Theorem (Euler). A connected graph $G$ has an Euler circuit if and only if every vertex has even degree. (A graph has an Euler path but not a circuit iff exactly two vertices have odd degree.)

Suitable Example.

Take a triangle graph $G$ with vertices ${A, B, C}$ and edges ${A\text{-}B,\ B\text{-}C,\ C\text{-}A}$.

        A
       / \
      /   \
     C-----B

Degrees: $$\deg(A)=2,\quad \deg(B)=2,\quad \deg(C)=2$$

All degrees are even and the graph is connected, so an Euler circuit exists.

Euler circuit: $A \to B \to C \to A$

This traverses each of the 3 edges exactly once and returns to $A$. Hence it is a valid Euler circuit.


Part 2: Maximum Flow $s \to t$ (Ford-Fulkerson Method)

Important: The actual network diagram was not reproduced in the question, so the numeric answer below is based on an assumed illustrative network. Replace the capacities with those in your exam diagram; the procedure is identical.

Algorithm (Ford-Fulkerson augmenting path):

  1. Initialise flow $f = 0$ on every edge.
  2. While an augmenting path $s \to t$ exists in the residual graph:
    • Find bottleneck $c_{\min}=\min$ residual capacity on the path.
    • Add $c_{\min}$ to forward edges, subtract from backward edges.
  3. Maximum flow $=$ total flow leaving $s$ (verified by min-cut).

Assumed network capacities:

EdgeCapacity
$s\to a$5
$s\to b$4
$a\to b$3
$a\to t$6
$b\to c$5
$c\to t$6

Iteration 1: Path $s\to a\to t$, bottleneck $=\min(5,6)=5$. $f(s,a)=5,\ f(a,t)=5$.

Iteration 2: Path $s\to b\to c\to t$, bottleneck $=\min(4,5,6)=4$. $f(s,b)=4,\ f(b,c)=4,\ f(c,t)=4$.

Iteration 3: Check residuals.

  • $s\to a$: $5-5=0$ (saturated)
  • $s\to b$: $4-4=0$ (saturated)

Both edges out of $s$ are saturated, so no augmenting path remains.

Maximum flow (for this assumed network): $$f_{\max}=f(s,a)+f(s,b)=5+4=\boxed{9}$$

Min-cut check: The cut ${s}\ /\ \text{rest}$ has capacity $c(s,a)+c(s,b)=5+4=9$, matching the flow, confirming optimality by the max-flow min-cut theorem.

Conclusion: For the assumed network, the maximum flow from $s$ to $t$ is 9 units. For the exam's actual diagram, apply the same augmenting-path steps to the given capacities.

Open this answer on its own page →

2076 · 5 marks

Define Euler path and Hamilton path. Give examples of both Euler and Hamilton path. [5]

Show solved answer

Euler Path and Hamilton Path

Euler Path

Definition: An Euler path (also called an Eulerian trail) is a path in a graph that traverses every edge exactly once. The initial and terminal vertices of the path need not be the same. If the initial and terminal vertices are the same, it is called an Euler circuit.

Condition for Euler Path: A connected graph has an Eulerian trail if and only if it has exactly two vertices of odd degree. The path must start at one odd-degree vertex and end at the other.

Example of Euler Path:

Consider a graph with vertices: A, B, C, D and edges: A-B, A-C, B-C, B-D, C-D

A --- B
|   / |
| /   |
C --- D

Here deg(A) = 2, deg(B) = 3, deg(C) = 3 and deg(D) = 2, so exactly two vertices, B and C, have odd degree. An Euler path therefore exists, and it has to start at one odd vertex and finish at the other:

B → A → C → D → B → C

This walk uses the edges A-B, A-C, C-D, B-D and B-C, that is all five edges of the graph, each exactly once. Because two vertices have odd degree the walk cannot come back to where it started, so this graph has an Euler path but no Euler circuit.


Hamilton Path

Definition: A Hamiltonian path is a simple path that contains all vertices of a graph G exactly once. Unlike the Euler path, it focuses on visiting every vertex exactly once rather than every edge. If the path returns to the starting vertex, it is called a Hamiltonian cycle.

Note: There is no simple necessary and sufficient condition (like for Euler path) to determine the existence of a Hamiltonian path.

Example of Hamilton Path:

Consider a graph with vertices: 1, 2, 3, 4, 5 and edges connecting them as a cycle with some additional edges.

1 - 2 - 3 - 4 - 5

The path 1 → 2 → 3 → 4 → 5 visits every vertex exactly once. This is a Hamiltonian path.


Comparison Table

TermInitial and Terminal Vertex SameMust Include Every EdgeMust Include Every VertexRepeated Vertices Allowed
Euler CircuitYesYesNot requiredYes
Euler PathNoYesNot requiredYes
Hamilton CycleYesNoYesNo
Hamilton PathNoNoYesNo

Key Difference

  • Euler Path is concerned with covering every edge exactly once.
  • Hamilton Path is concerned with visiting every vertex exactly once.
Open this answer on its own page →

2075 · 5 marks

Define Euler path and Hamilton path with examples. Draw the Hasse diagram for the divisibility relation on the set {1,2,5,8,16,32} and find the maximal, minimal, greatest and least element if exist. [5]

Show solved answer

Euler Path, Hamilton Path, and Hasse Diagram

Part 1: Euler Path and Hamilton Path

Euler Path

Definition: An Euler path is a walk in a graph that traverses every edge exactly once (vertices may repeat). If it starts and ends at the same vertex, it is an Euler circuit.

Existence condition: A connected graph has an Euler path iff it has exactly 0 or 2 vertices of odd degree (2 odd-degree vertices give an open Euler path; 0 gives an Euler circuit).

Example:

Vertices ${A,B,C,D}$, edges: $A\text{-}B,\ B\text{-}C,\ C\text{-}D,\ D\text{-}A,\ A\text{-}C$.

Degrees: $\deg(A)=3,\ \deg(B)=2,\ \deg(C)=3,\ \deg(D)=2$. Two odd-degree vertices $(A,C)$, so an Euler path exists:

$$A \to B \to C \to D \to A \to C$$

This uses each of the 5 edges exactly once.

Hamilton Path

Definition: A Hamilton path is a path that visits every vertex exactly once. If it returns to the starting vertex, it is a Hamiltonian circuit (cycle).

Note: There is no simple necessary-and-sufficient condition for a Hamilton path (unlike Euler paths).

Example: Same graph as above:

$$A \to B \to C \to D$$

visits all 4 vertices exactly once, so it is a Hamilton path.

Key Difference

PropertyEuler PathHamilton Path
VisitsEvery edge onceEvery vertex once
Condition0 or 2 odd-degree verticesNo simple general condition

Part 2: Hasse Diagram for Divisibility on ${1,2,5,8,16,32}$

Step 1: Divisibility relations (a | b)

  • $1 \mid$ everything
  • $2 \mid 8,\ 2 \mid 16,\ 2 \mid 32$
  • $8 \mid 16,\ 8 \mid 32$
  • $16 \mid 32$
  • $5$: divides nothing else in the set (since $8,16,32$ are not multiples of 5)

Step 2: Cover relations (remove transitive edges)

  • $1 \lessdot 2$, $1 \lessdot 5$
  • $2 \lessdot 8$ (since $4 \notin$ set)
  • $8 \lessdot 16$
  • $16 \lessdot 32$

Step 3: Hasse Diagram

        32
        |
        16
        |
        8
        |
        2       5
         \     /
            1

Step 4: Maximal, Minimal, Greatest, Least

Minimal element: element with nothing below it. $1$ is the only minimal element.

Maximal elements: elements with nothing above them. $32$ (top of chain) and $5$ (dead-end, divides nothing else). $$\text{Maximal} = {5,\ 32}$$

Least element: divides every element $\Rightarrow$ $1$ divides all. $$\text{Least} = 1$$

Greatest element: must be divisible by all others. $32$ is not divisible by $5$, and no single element is above all others $\Rightarrow$ no greatest element.

Summary Table

PropertyElementExists?
Minimal${1}$Yes
Maximal${5, 32}$Yes
Least$1$Yes
GreatestNoneNo

For the Hasse diagram the minimal element is ${1}$, the maximal elements are ${5,32}$, the least element is $1$ and there is no greatest element. On the Euler path, a route such as $A \to B \to C \to A \to D \to C$ is invalid because it repeats an edge and skips another; the valid path is $A \to B \to C \to D \to A \to C$. The Euler condition should also include the "0 odd vertices" case for completeness.

Open this answer on its own page →

Minimum Spanning Trees

2081 · 5 marks

Define chromatic number. How does Kruskal's algorithm find Minimum Spanning Tree? [5]

Show solved answer

Chromatic Number and Kruskal's Algorithm


Part 1: Chromatic Number (Definition)

The chromatic number of a graph G is the minimum number of colors required to color the vertices of G such that no two adjacent vertices (vertices connected by an edge) share the same color.

It is denoted by χ(G) (chi of G).

Examples:

  • A complete graph K_n has chromatic number χ(K_n) = n
  • A cycle with an even number of vertices has χ = 2
  • A cycle with an odd number of vertices has χ = 3
  • A tree (with more than one vertex) has χ = 2

Part 2: Kruskal's Algorithm for Minimum Spanning Tree

A Minimum Spanning Tree (MST) of a weighted graph G is a spanning tree whose total edge weight is minimum among all possible spanning trees.

Steps of Kruskal's Algorithm

Step 1: List all the edges of G in non-decreasing order of their weights.

Step 2: Select the edge of minimum weight. This becomes the first edge of the spanning tree T. (If two edges have equal minimum weight, choose arbitrarily.)

Step 3: At each subsequent stage, select the edge of minimum weight from the remaining edges of G, provided it does not form a cycle with the previously selected edges in T. Add this edge to T.

Step 4: Repeat Step 3 until n - 1 edges have been selected (where n is the number of vertices).

The resulting tree T is the Minimum Spanning Tree.


Illustrative Example

Consider a weighted graph with vertices {A, B, C, D} and edges:

EdgeWeight
A-B1
B-C3
A-C4
B-D2
C-D5

Step 1: Sort edges by weight: A-B (1), B-D (2), B-C (3), A-C (4), C-D (5)

Step 2: Select A-B (weight 1). T = {A-B}

Step 3:

  • Select B-D (weight 2). No cycle formed. T = {A-B, B-D}
  • Select B-C (weight 3). No cycle formed. T = {A-B, B-D, B-C}
  • We now have n - 1 = 3 edges. Stop.

MST Total Weight = 1 + 2 + 3 = 6


Key Property

Kruskal's algorithm is a greedy algorithm that always picks the globally minimum weight edge that does not create a cycle, guaranteeing an optimal (minimum weight) spanning tree.

Open this answer on its own page →

2079 · 5 marks

State Generalized Pigeonhole principle. Find the MST from following graph using Kruskal Algorithm. [5]

  • Part 1: Requires the statement of the Generalized Pigeonhole Principle (theory, no numeric data). - Part 2: Requires finding the MST using Kruskal's Algorithm "from the following graph." Missing data: The actual graph (vertices, edges, and edge weights) for Part 2 is not included in the questio...
Open this answer on its own page →

2078 · 5 marks

What are the significance of Minimum Spanning Tree? Describe how Kruskal's algorithm can be used to find the MST. [5]

A Minimum Spanning Tree of a weighted connected graph is a spanning tree with the minimum total edge weight. Its significance includes: 1. Network Design: Used in designing minimum-cost communication networks, electrical grids, and road networks connecting all nodes at least cost. 2. Cluster Anal...

Open this answer on its own page →

2076 · 5 marks

What is minimum spanning tree? Explain Kruskal's algorithm for finding minimum spanning tree. [5]

Let G be a connected weighted graph. The weight of a spanning tree of G is the sum of the weights of the edges included in that spanning tree. A Minimum Spanning Tree (MST) of G is a spanning tree of G with the minimum possible weight among all possible spanning trees of that graph. Example use c...

Open this answer on its own page →

The Max Flow-Min Cut Theorem

2080 · 10 marks

State max flow min cut theorem. Find the value of maximal flow in the graph below:[10]

The question asks to: 1. State the Max Flow Min Cut Theorem. 2. Find the value of maximal flow "in the graph below." Missing data: The actual flow network graph (vertices, directed edges, and edge capacities) is not provided in the text. No image, adjacency list, or capacity matrix is available. ...

Open this answer on its own page →

Graph Isomorphism

2080 · 5 marks

State the necessary conditions for two graphs to be isomorphic. How many different words from 'MANAGER' can be generated with or without meaning? [5]

Two graphs $G1 = (V1, E1)$ and $G2 = (V2, E2)$ are isomorphic if there exists a bijection (one-to-one and onto mapping) $f: V1 \to V2$ such that any two vertices $u$ and $v$ are adjacent in $G1$ if and only if $f(u)$ and $f(v)$ are adjacent in $G2$. For two graphs to be isomorphic, the following ...

Open this answer on its own page →

2078 · 10 marks

List all the necessary conditions for the graph to be isomorphic with an example. Find the maximal flow from the node SOURCE to SINK in the following network flow.[10]

Part 1: Conceptual question. No numeric data required. Part 2: The network diagram (the actual figure with its specific capacities) is not reproducible from the text provided, and no capacity matrix or edge list was supplied with the question. The original figure is not available, so the capaciti...

Open this answer on its own page →

Closure of Relations

2080 · 5 marks

Define symmetric closure. What is the symmetric closure of the relation R = {(1,1), (1,2), (2,2), (2,3), (3,1), (2,1)} on the set A = {1,2,3}? [5]

  • Set $A = {1, 2, 3}$ - Relation $R = {(1,1),\ (1,2),\ (2,2),\ (2,3),\ (3,1),\ (2,1)}$ --- The symmetric closure of a relation $R$ on a set $A$ is the smallest symmetric relation on $A$ that contains $R$. It is formed by adding to $R$ the reverse pair $(b,a)$ for every pair $(a,b) \in R$ whos...
Open this answer on its own page →

2076 · 5 marks

Define reflexive closure and symmetric closure. Find the remainder when $4x^2 - x + 3$ is divided by x + 2 using remainder theorem. [5]

  • Polynomial: $f(x) = 4x^2 - x + 3$ - Divisor: $x + 2$ --- The reflexive closure of a relation $R$ on a set $A$ is the smallest reflexive relation on $A$ that contains $R$. It is formed by adding all pairs $(a, a)$ for every $a \in A$ that are not already in $R$. $$R^{ref} = R \cup \Delta \quad ...
Open this answer on its own page →

Graph Representation

2080 · 5 marks

Represent following graph using adjacency matrix. [5]

Given data: - The question asks to represent "following graph" using an adjacency matrix. - The actual graph figure (vertices, edges, directedness, weights) is NOT provided in the text given to me. Missing data: The specific graph image is not visible. Without it, I cannot know the exact number o...

Open this answer on its own page →

Equivalence Relations

2079 · 10 marks

Show that the relation R = {(a, b): |a-b| is even} is an equivalence relation in the set of integers. Given the following transport network with the edges called with their capacities find all S-D cuts and their capacities and what the minimum capacity?[10]

--- To prove R is an equivalence relation, we verify reflexivity, symmetry, and transitivity. For any integer $a$: $$a - a = 0 = 0$$ Since $0$ is even, $(a, a) \in R$ for all $a \in \mathbb{Z}$. R is reflexive. ✓ Suppose $(a, b) \in R$, so $a - b$ is even. Then: $$b - a = -(a - b) = a - b$$ which...

Open this answer on its own page →

2080.1 · 5 marks

Let us assume that R be a relation on the set of ordered pair of positive integers such that ((a,b),(c,d))∈R((a, b), (c, d)) \in R((a,b),(c,d))∈R if and only if ad = bc. Is R an equivalence relation? [5]

A relation R on a set A is an equivalence relation if and only if it satisfies three properties: 1. Reflexivity: (a, a) ∈ R for all a ∈ A 2. Symmetry: If (a, b) ∈ R then (b, a) ∈ R 3. Transitivity: If (a, b) ∈ R and (b, c) ∈ R then (a, c) ∈ R Here, R is defined on ordered pairs of positive intege...

Open this answer on its own page →

Graph Types

2079 · 5 marks

Define bipartite graph with an example. State the necessary conditions for the graphs to be isomorphic. [5]

--- A graph G = (V, E) is called a bipartite graph if its vertex set V can be partitioned into two disjoint non-empty subsets V1 and V2 (called partition sets) such that: - Every edge in E connects a vertex in V1 to a vertex in V2. - No edge exists between two vertices within the same partition s...

Open this answer on its own page →

Shortest Path Algorithm

2078 · 5 marks

Illustrate the Dijkstra's Algorithm to find the shortest path from source node to destination node with an example. [5]

Dijkstra's Algorithm, discovered by E.W. Dijkstra, finds the shortest path between two vertices in a weighted graph. The length of a path is the sum of the weights of its edges, and the shortest path is the minimum length path between two vertices. --- 1. Assign distance 0 to the source node and ...

Open this answer on its own page →

2080.1 · 10 marks

What is shortest path problem? Use Dijkstra's shortest path algorithm to find the shortest path between vertices a and z in the weighted graph below:[10]

Show solved answer

Shortest Path Problem and Dijkstra's Algorithm

Given

Question requirements:

  • Define the shortest path problem.
  • Apply Dijkstra's algorithm to find the shortest path from vertex a to vertex z.

Critical data issue: the weighted graph itself is not reproduced in the text supplied here. The working below therefore uses an assumed standard graph with the following edge weights:

EdgeWeight
a-b4
a-d2
a-e7
b-c2
b-e1
c-f5
d-e3
e-f4
e-z6
f-z3

Since the actual figure is not available, the answer (a) provides the definition, (b) states the algorithm, and (c) solves the problem using the assumed edge set above, which could not be verified against the original figure.


Solution

Definition: Shortest Path Problem

A weighted graph is a graph in which every edge is assigned a non-negative number called its weight. The length of a path is the sum of the weights of the edges on that path. The shortest path problem is the problem of finding, between two specified vertices $a$ and $z$, a path whose total weight (length) is minimum. Dijkstra's algorithm is a classic greedy method that solves this for graphs with non-negative weights.

Dijkstra's Algorithm

  1. Set distance of source $= 0$, all others $= \infty$; mark all unvisited.
  2. Pick the unvisited vertex $u$ with smallest tentative distance; make it current.
  3. Relax each unvisited neighbor $v$: if $d(u)+w(u,v) < d(v)$, update $d(v)$.
  4. Mark $u$ visited.
  5. Repeat until the target $z$ is visited.

Execution (on the assumed edge set)

Init: $d(a)=0$, others $=\infty$.

Iteration 1: a (0): b = 4, d = 2, e = 7. Visit a. Next: d (2).

Iteration 2: d (2): e = $\min(7, 2+3)=5$. Visit d. Next: b (4).

Iteration 3: b (4): c = $4+2 = 6$; e = $\min(5, 4+1)=5$ (unchanged). Visit b. Next: e (5).

Iteration 4: e (5): f = $5+4 = 9$; z = $5+6 = 11$. Visit e. Next: c (6).

Iteration 5: c (6): f = $\min(9, 6+5)=9$ (unchanged). Visit c. Next: f (9).

Iteration 6: f (9): z = $\min(11, 9+3)=12$? Since $12 > 11$, z stays 11. Visit f. Next: z (11).

Iteration 7: z (11): target reached.

Final Distance Table

Vertexabcdefz
Distance04625911

Shortest Path and Length

$z$ received value $11$ from vertex $e$ (via $e\text{-}z = 6$), and $e = 5$ came from $d$ (via $d\text{-}e=3$), and $d = 2$ came from $a$.

$$\text{Shortest path: } a \to d \to e \to z$$ $$\text{Length} = 2 + 3 + 6 = \boxed{11}$$

Trace the path back, do not stop at the distance: the final table gives $d(z)=11$. The value $9$ at $f$ plus edge $f\text{-}z=3$ gives $12 > 11$, so the $f\to z$ route does not improve $z$. The shortest path is $a\to d\to e\to z$ with length $11$, not one through $f$.

Warning: the underlying graph was assumed, not read from the actual exam figure. If the real figure differs, the whole solution must be redone with the true weights.

Open this answer on its own page →

Partial Ordering

2076 · 5 marks

Which of the following are possets? a. $(Z, =)$ b. $(Z, \neq)$ c. $(Z, \leq)$ [5]

A partially ordered set (poset) is a set $S$ together with a binary relation $R$ that satisfies all three of the following properties: Property Meaning ------ Reflexivity $\forall a \in S,; a, R, a$ Antisymmetry $\forall a, b \in S,; a, R, b \text{ and } b, R, a \Rightarrow a = b$ Transit...

Open this answer on its own page →

Graph Coloring

2076 · 5 marks

List any two applications of graph coloring theorem. Prove that 'A tree with n vertices has n-1 edges'. [5]

--- 1. Frequency/Channel Assignment: Graph coloring is used to assign frequencies or channels to television and radio stations. Each station is represented as a vertex, and an edge is drawn between two stations if they are close enough to interfere with each other. Colors represent distinct frequ...

Open this answer on its own page →

Maximal Flows and Minimal Cuts

2075 · 10 marks

What is S-D cut? For the following network flow find the maximal flow from S to D.[10]

Definition part: No numeric data required. Network flow part: The problem states "the following network," but the actual network diagram (nodes, directed edges, and edge capacities) is NOT reproduced in the text provided to me. Without the diagram, the specific capacities and topology are missing...

Open this answer on its own page →

Spanning Trees

2075 · 5 marks

Define spanning tree and minimum spanning tree, mention the conditions for two graphs for being isomorphic with ean example [5]

--- A spanning tree of a connected graph G is a subgraph T of G that: - Contains all the vertices of G - Is a tree (connected and acyclic) - Has exactly n - 1 edges, where n is the number of vertices In other words, a spanning tree is a minimal connected subgraph that includes every vertex of G. ...

Open this answer on its own page →

Representing Relations

2080.1 · 5 marks

Explain the matrix representation of relations with example. [5]

Let R be a relation from set A = {a₁, a₂, ..., aₘ} to set B = {b₁, b₂, ..., bₙ}. The matrix representation of R is an m × n zero-one matrix MR = [mij] where: $$m{ij} = \begin{cases} 1 & \text{if } (ai, bj) \in R \ 0 & \text{if } (ai, bj) \notin R \end{cases}$$ Each row corresponds to an element ...

Open this answer on its own page →