Math Week 10 Solns
Math Week 10 Solns
(a) n2
n(n−1)
(b) 2
n(n−1)
(c) 4
(d) n(n − 1)
Solution:
Number of non zero entry means number of ones in the adjacency matrix which is
equal to the sum of the degrees of all vertices. In a graph a vertex can have maximum
n − 1 degree. In at most case if each vertex has the degree n − 1, then the sum of
degrees of all vertex will be (n − 1) + (n − 1) + .....n times which means n × (n − 1).
2. We have a graph G with 6 vertices. We write down the degrees of all vertices in G in
descending order. Which of the following is a possible listing of the degrees? [option:
c]
(a) 6,5,4,3,2,1
(b) 5,5,2,2,1,1
(c) 5,3,3,2,2,1
(d) 2,1,1,1,1,1
Solution:
Step 1:
Any vertex in a graph can have maximum degree (n-1).
Here n-1 = 6-1 = 5, therefore we do not need to check option 1.
Step 2:
Sum of degree of all vertices always be even therefore option 4 can not be correct
option.
Step 3:
If two vertices in a graph have (n-1) degree it means there will be no vertex with degree
1 (shown in figure ). Vertices A and F have degree 5.
B C
A D
F E
Step 4:
Option 3 satisfies all the possible conditions therefore the correct option is option 3.
Page 2
B C
A D
F E
Page 3
3. We are trying to find the correct path in a maze. We start at the entrance. At some
points, we have to choose a direction to explore. If we reach a dead end, we come
back to the most recent intersection where we still have an unexplored direction to
investigate. What is a good data structure to keep track of the intersections we have
visited? [option: b]
(a) List
(b) Stack
(c) Queue
(d) Array
Solution:
This is a recursive exploration of the maze, so intermediate stages should be stored on
a stack.
Page 4
4. Below table shows the adjacency list w.r.t outgoing edges of a directed graph G.
1 {2,4}
2 {3,5,6}
3 {7}
4 {3,5,6}
5 {6,7}
6 {1}
7 {1,2,6}
Which of the following tables shows the adjacency list w.r.t incoming edges of the
graph G? [option: c]
1 {6,7}
2 {1,6}
3 {2,4}
4 {1}
5 {2,7}
6 {2,4,5,7}
7 {3,5}
(a)
1 {6,7}
2 {1,7}
3 {2,4}
4 {1,5}
5 {2,4}
6 {2,4,7}
7 {3,5}
(b)
Page 5
1 {6,7}
2 {1,7}
3 {2,4}
4 {1}
5 {2,4}
6 {2,4,5,7}
7 {3,5}
(c)
1 {6,7}
2 {1,4}
3 {2,7}
4 {1,5}
5 {2,4}
6 {2,4,7}
7 {3,5}
(d)
Page 6
5. Suppose we obtain the following BFS tree rooted at node 1 for an undirected graph
with vertices (1,2,3,4,5,.....14).
5 4 10
6 11 3 12
7 2 9 13
8 14
(a) (8,11)
(b) (3,10)
(c) (4,5)
(d) (6,9)
Page 7
(a)
(b)
(c)
(d)
Page 8
Page 11
x6
x10 x2 x7
x1 x4
x3 x5
x9 x8
Page 12
10. An incomplete undirected graph is given below and the numbering on each vertex
denotes the colouring of the graph(‘1’ denotes color 1, ‘2’ denotes color 2, and ‘3’
denotes color 3). Find the number of maximum edges that can be added to the given
graph such that the colouring is retained and the graph is planar.
NOTE: Planar graph is a graph that can be drawn on the plane in such a way that its
edges intersect only at their endpoints. [Answer: 6]
1 2 3
3
1
2
1
Page 13