0% found this document useful (0 votes)
17 views5 pages

Graphs

Uploaded by

dugopapavo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views5 pages

Graphs

Uploaded by

dugopapavo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Extra Questions: Graphs Eng: Heba Al-Hiary

Q1: Consider the following graph (G):

How many strongly connected components are there in the above graph?

Answer is 5. A directed graph is strongly connected if there is a path between all pair of
vertices.
The strongly components are:
1. A-B-F-C

2. E

3. D

4. G

5. H
so totally 5
Q2: Consider a complete undirected graph with vertex set {0, 1, 2, 3, 4}. Entry Wij in the
matrix W below is the weight of the edge {i, j}. Answer the 1 and 2

0 1 8 1 4
1 0 12 4 9
8 12 0 7 3
1 4 7 0 2
4 9 3 2 0

1. What is the minimum possible weight of a spanning tree T in this graph?


(a) 7
(b) 8
(c) 9
(d) 10

2. The time complexity to calculate the number of edges in this graph whose
information in stored in form of the above adjacency matrix is ____________
a) O(V)
b) O(E2)
c) O(E)
d) O(V2)

Q3: For the adjacency matrix of a directed graph the row sum is the _________ degree
and the column sum is the ________ degree.
a) in, out
b) out, in
c) in, total
d) total, out
Answer: b
Explanation: Row number of the matrix represents the tail, while Column number
represents the head of the edge.

Q4: Adjacency matrix of all graphs are symmetric.


a) False
b) True
Answer: a
Explanation: Only undirected graphs produce symmetric adjacency matrices.
Q5: Here is an adjacency list representation of a directed graph where there are no weights
assigned to the edges.

1. Draw a picture of the directed graph that has the above adjacency list
representation.

2. Represent the graph as an adjacency matrix.

A B C D
A 0 1 1 1
B 1 0 0 0
C 0 1 0 1
D 0 0 0 0

Q6: How many minimum spanning trees are possible using Kruskal’s algorithm for a given
graph –
• If all edges weight are distinct, minimum spanning tree is unique.
• If two edges have same weight, then we have to consider both possibilities and find
possible minimum spanning trees.
Q7: The number of elements in the adjacency matrix of a graph having 7 vertices is
__________
a) 7
b) 14
c) 36
d) 49
Q8: Given an adjacency matrix A = [ [0, 1, 1], [1, 0, 1], [1, 1, 0] ], how many ways are
there in which a vertex can walk to itself using 2 edges.
a) 2
b) 4
c) 6
d) 8
Q9: If A[x+3][y+5] represents an adjacency matrix, which of these could be the value of
x and y.
a) x=5, y=3
b) x=3, y=5
c) x=3, y=3
d) x=5, y=5
Q10: For a given graph G having v vertices and e edges which is connected and has no
cycles, which of the following statements is true?
a) v=e
b) v = e+1
c) v + 1 = e
d) None of the mentioned

Q11: Suppose you have a directed graph representing all the flights that an airline flies.
What algorithm might be used to find the best sequence of connections from one city to
another?

• A. Breadth first search.


• B. Depth first search.
• C. A cycle-finding algorithm.
• D. A shortest-path algorithm.

Q12: What graph traversal algorithm uses a queue to keep track of vertices which need to
be processed?
• A. Breadth-first search.
• B. Depth-first search

Q13: Given the following adjacency list which represents graph G:

A. How many vertices are there in G? Answer: 13 (012)


B. How many edges are there in G? 22
C. Draw the graph.

You might also like