Assignment 2
Assignment 2
Assignment #. 01
MT3001_Graph Theory_Fall 2024
1. You must submit your solution in given timeline. Submissions submitted after the due time shall not be
considered.
2. If you do not finish every part of a question, do not worry! You can still submit what you have done to get
marks based on your efforts.
3. In case of copied or plagiarized solution student will be awarded zero marks in all assignments and it will
affect your grade.
Questions
Q.1
a) Analyze the following graphs and determine whether they are Eulerian, Semi-Eulerian, Hamiltonian, or Semi-Hamiltonian.
Justify your answers in detail.
i) Complete Graph K6
ii) Complete Bipartite Graph K3,4
iii) Grid Graph 3×3
iv) Petersen Graph
Q.2
Draw the binary tree to represent the following expression and write the expression in pre-order notation.
a) (x+3y)^5 (a-3b)
b) ((5* a)+(3- (6* a))+(a-3*b))
c) (((a * b)- c)^ d)-(( e * f)+ g). Write the corresponding expression in postorder and preorder notations and hence find the
value when a=3, b=4, c=5, d=2, e=6 ,f =7 and g =1.
Best of Luck
National University
Of Co mputer & Emerg ing Sciences-CFD ca mpu s
Assignment #. 01
MT3001_Graph Theory_Fall 2024
Q.3 Draw all possible spanning trees of K5 and identify the possible isomorphic classes of these spanning trees.
Q.5
Proof the following:
a) Show that if a tree has exactly two pendant vertex, the degree of other two vertices are 2.
b) Let T be a tree with 50 edges. The removal of a certain edge from T yields to disjoint trees T1 and T2. Given that the
number of vertices in T1 equals the number of edges in T2. Determine the number of vertices and edges in T1 and
T2.
Q.6
Floyd-Warshall Algorithm
a) Use the Floyd-Warshall algorithm to compute the shortest paths between all pairs of vertices in the following
graph:
Vertices: {1, 2, 3, 4}
Matrix representation:
1 2 3 4
1 0 3 INF 7
2 3 0 1 INF
3 INF 1 0 2
4 7 INF 2 0
Q.7
Write code of following:
a) Implement Kruskal’s algorithm in Python.
b) Write a Python function for Prim’s algorithm.
Best of Luck
National University
Of Co mputer & Emerg ing Sciences-CFD ca mpu s
Assignment #. 01
MT3001_Graph Theory_Fall 2024
Q.8
a)Explain the difference between a spanning tree and a minimal spanning tree.
b) Show step-by-step how the labeling algorithm can be used to find the minimal spanning tree for the graph:
Vertices: {1, 2, 3, 4}
Edges and weights: {12: 7, 13: 4, 23: 3, 24: 6, 34: 5}
Q.9
a) What is the chromatic number of a complete graph Kn?
b) For the following graph, find the chromatic number:
Vertices: {A, B, C, D, E, F}
Edges: {AB, AC, AD, AE, BC, BD, BE, CF, DF, EF}
Q.10
Given the following graph:
Vertices: {A, B, C, D, E, F}
Edges: {AB, AC, AD, AE, BC, BD, BE, CF, DF, EF}
Implement the labeling algorithm to assign labels (colors) to the vertices. Use the greedy coloring method where
each vertex gets the lowest available label that does not conflict with its neighbors.
Provide the following:
● The steps of the labeling algorithm used.
● The color assignment for each vertex.
● The chromatic number of the graph.
Best of Luck
National University
Of Co mputer & Emerg ing Sciences-CFD ca mpu s
Best of Luck