Assignment Key Unit-5(Set 1 & 2)
Assignment Key Unit-5(Set 1 & 2)
LONGANSWERQUESTIONS:
6a) Compare and contrast Hamiltonian graphs and Euler circuits with examples.
Hamiltonian Graph:
• A Hamiltonian graph is a graph that contains a Hamiltonian cycle, i.e., a cycle that visits each vertex of the
graph exactly once and returns to the starting vertex.
• A Hamiltonian path visits each vertex exactly once, but it doesn't necessarily form a cycle.
• Example of a Hamiltonian graph: A simple pentagon (5 vertices) is a Hamiltonian cycle because it forms a
closed path where each vertex is visited once.
Euler Circuit:
• An Euler circuit is a cycle in a graph that visits every edge exactly once and returns to the starting vertex.
• A graph must have even degree vertices to contain an Euler circuit. If a graph has an odd degree for any
vertex, it does not have an Euler circuit.
• Example of an Euler circuit: A simple square (4 vertices) is an Euler circuit since we can start at any vertex
and trace all edges exactly once.
Key Differences:
• A Hamiltonian cycle involves visiting all vertices exactly once, while an Euler circuit involves visiting all
edges exactly once.
• A Hamiltonian graph may or may not have an Euler circuit, and vice versa.
Example:
• Hamiltonian Graph: A pentagon (5 vertices).
• Euler Circuit: A square (4 vertices).
7) a) Derive a minimum spanning tree from the given weighted graph using Kruskal's algorithm.
7b) Check whether a Petersen graph shown in Figure has a Hamiltonian cycle or not.
The Petersen graph is a famous 3-regular graph with 10 vertices and 15 edges. It has some interesting properties and
is frequently used in graph theory. One of the key questions about the Petersen graph is whether it contains a
Hamiltonian cycle.
Key Properties of the Petersen Graph:
• It has 10 vertices and 15 edges.
• It is a 3-regular graph, meaning each vertex has a degree of 3.
• The Petersen graph is non-Hamiltonian, meaning it does not contain a Hamiltonian cycle.
Why the Petersen Graph does not have a Hamiltonian Cycle:
• A Hamiltonian cycle is a cycle that visits every vertex exactly once and returns to the starting vertex.
• Despite its simplicity and symmetric structure, the Petersen graph does not have a Hamiltonian cycle.
Proof Outline:
1. Trial and Error: Trying to find a Hamiltonian cycle in the Petersen graph would involve attempting to form a
cycle that includes every vertex exactly once and returns to the starting point. However, this attempt is
unsuccessful because it is impossible to connect the vertices in such a way.
2. Graph Theory Result: It is a well-known result in graph theory that the Petersen graph does not contain a
Hamiltonian cycle. This has been proven through theoretical analysis, where no Hamiltonian cycle can be
formed.
Conclusion:
The Petersen graph does not have a Hamiltonian cycle. This conclusion holds true for all representations of the
Petersen graph, regardless of the specific labeling of vertices or edges.
8a)Determine the minimum spanning tree of the weighted graph shown in the figure.
9) (a) Let G be a connected planar simple graph with 20 vertices and the degree of each vertex is 3. Find the
number of regions in G.
We can use Euler’s formula for planar graphs to determine the number of regions. Euler's formula states:
V-E+R=2
Where:
• V is the number of vertices,
• E is the number of edges,
• R is the number of regions (also known as the number of faces).
Given:
• Number of vertices, V = 20,
• Each vertex has degree 3, so the total degree of all vertices is 3 × 20 = 60. The sum of degrees of all vertices is
twice the number of edges (because each edge is counted twice), so:
2E = 60
E = 30
Now, using Euler's formula:
V-E+R=2
Substitute the values of V and E:
20 - 30 + R = 2
Solve for R:
R = 12
So, the graph G has 12 regions.
To create a Minimum Spanning Tree (MST) using the DFS (Depth-First Search) algorithm, we need to traverse the
graph in a depth-first manner and construct a tree that includes all vertices without forming cycles. However, DFS
alone does not guarantee a minimum spanning tree. Instead, we typically use Kruskal's or Prim's algorithms for
MSTs.
Step 1: Perform DFS Traversal
We start from an arbitrary vertex (e.g., A) and traverse the graph using DFS, keeping track of the edges that form the
spanning tree.
SHORTANSWERQUESTIONS:
1) What is the chromatic number of K_n? Explain.
The chromatic number of a graph is the smallest number of colors needed to color the vertices of the graph such that
no two adjacent vertices share the same color.
For the complete graph K_n, every vertex is connected to every other vertex. Therefore, each vertex must have a
unique color to avoid adjacent vertices having the same color. Hence, the chromatic number of K_n is n.
6b) Using Prim's algorithm, determine the minimal spanning tree for a given graph.
To determine the Minimum Spanning Tree (MST) of the given graph using Prim's Algorithm, follow these steps:
Step 1: Initialize
• Choose any vertex to start. Let's choose vertex a to start the algorithm.
• Create a set of visited vertices (initially containing only the starting vertex a).
• Initialize an empty set of edges for the MST.
• The edges list will be updated as we add edges with the least weights.
Step 2: Prim's Algorithm Steps
Iteration 1: Start from vertex a
• From vertex a, we have the following edges:
o a - f (weight 1)
o a - e (weight 2)
o a - b (weight 11)
o a - c (weight 9)
• Choose the edge with the least weight: a - f with weight 1.
• Add vertex f to the visited set.
• Add edge a - f to the MST.
Iteration 2: Add vertex f to the set
• Now, from vertex f, the following edges are available:
o f - a (already in MST)
o f - e (weight 3)
o f - b (weight 8)
o f - c (weight 10)
o f - d (weight 6)
• Choose the edge with the least weight: f - e with weight 3.
• Add vertex e to the visited set.
• Add edge f - e to the MST.
Iteration 3: Add vertex e to the set
• From vertex e, the following edges are available:
o e - a (already in MST)
o e - f (already in MST)
o e - b (weight 8)
o e - c (weight 7)
o e - d (weight 4)
• Choose the edge with the least weight: e - d with weight 4.
• Add vertex d to the visited set.
• Add edge e - d to the MST.
Iteration 4: Add vertex d to the set
• From vertex d, the following edges are available:
o d - e (already in MST)
o d - f (already in MST)
o d - c (weight 5)
• Choose the edge with the least weight: d - c with weight 5.
• Add vertex c to the visited set.
• Add edge d - c to the MST.
Iteration 5: Add vertex c to the set
• From vertex c, the following edges are available:
o c - e (already in MST)
o c - d (already in MST)
o c - b (weight 8)
• Choose the edge with the least weight: c - b with weight 8.
• Add vertex b to the visited set.
• Add edge c - b to the MST.
Iteration 6: All vertices visited
• All vertices are now visited. The algorithm stops here.
Step 3: Resulting Minimum Spanning Tree (MST)
The edges included in the MST are:
1. a - f with weight 1
2. f - e with weight 3
3. e - d with weight 4
4. d - c with weight 5
5. c - b with weight 8
Step 4: Total Weight of the MST
The total weight of the MST is the sum of the edge weights:
• 1 + 3 + 4 + 5 + 8 = 21
Final Minimum Spanning Tree (MST)
• Vertices: a, b, c, d, e, f
• Edges:
o a - f (weight 1)
o f - e (weight 3)
o e - d (weight 4)
o d - c (weight 5)
o c - b (weight 8)
The total weight of the MST is 21.
To obtain the dual of the given planar graph, follow these steps:
Step 1: Draw the original graph
The graph is given with vertices: A, B, C, D, E, F and the following edges:
• A-B
• B-C
• C-E
• C-F
• F-E
• E-D
• D -A
• A-E
Step 2: Create a new vertex for each region of the graph
Each face (region) of the planar graph, including the outer region, will be represented by a vertex in the dual graph.
• Regions of the original graph:
o Region 1: B - C - E - F
o Region 2: C - F - E - D
o Region 3: A - B - C - D
o Region 4: A - D - E - F
o Region 5: The outer region (not enclosed by any edges)
Step 3: Place a vertex in each region
• Place a vertex for each region:
o Vertex 1: Corresponding to the region B - C - E - F
o Vertex 2: Corresponding to the region C - F - E - D
o Vertex 3: Corresponding to the region A - B - C - D
o Vertex 4: Corresponding to the region A - D - E - F
o Vertex 5: Corresponding to the outer region.
Step 4: Draw edges between dual vertices
Draw an edge between two vertices in the dual graph if the corresponding regions in the original graph share an edge.
• Edge A - B in the original graph corresponds to an edge between Region 3 and Region 1 in the dual graph.
• Edge B - C in the original graph corresponds to an edge between Region 3 and Region 1.
• Edge C - E in the original graph corresponds to an edge between Region 1 and Region 2.
• Edge C - F in the original graph corresponds to an edge between Region 2 and Region 4.
• Edge F - E in the original graph corresponds to an edge between Region 2 and Region 1.
• Edge E - D in the original graph corresponds to an edge between Region 2 and Region 4.
• Edge D - A in the original graph corresponds to an edge between Region 3 and Region 4.
• Edge A - E in the original graph corresponds to an edge between Region 3 and Region 4.
Step 5: Final dual graph
The dual graph will have the following vertices and edges:
• Vertices: 1, 2, 3, 4, 5
• Edges:
o Between vertex 1 and 2
o Between vertex 2 and 4
o Between vertex 4 and 3
o Between vertex 1 and 3
o Between vertex 1 and 4
This is the dual graph of the given planar graph.
9) Draw and explain the BFS and DFS algorithms for the following graph.
For the BFS (Breadth-First Search) and DFS (Depth-First Search) algorithms, follow these steps:
1. BFS:
o Start at the source vertex.
o Visit all neighbors at the current level before moving to the next level.
o Continue until all vertices are visited.
2. DFS:
o Start at the source vertex.
o Visit the unvisited vertex closest to the source, following each vertex’s unvisited neighbor.
o Backtrack when no more unvisited neighbors are available.
10) Consider the following graph G as shown in the figure. Find its incidence matrix M.
The incidence matrix of a graph represents the relationship between vertices and edges. It is a matrix with
rows representing vertices and columns representing edges. If a vertex is incident to an edge, mark the
corresponding entry with a 1, and 0 otherwise.