507 views
3 votes
3 votes
Consider DFS over undirected graph with 4 vertices <A;B;C;D>. The discovery and finishing times of them in the order A to D are given. Select the option from following showing more than one connected components:
1) <(1,6), (2,5), (3,4), (8,10)>
2) <(6,7), (2,5), (3,4), (8,9)>
3) <(4,5), (2,8), (1,7), (3,6)>
4) <(7,8), (1,2), (5,6), (3,4)>

1 Answer

0 votes
0 votes
In this question the given information is:

1. Graph is connected

2. There are 4 vertices  of the graph

3. The DFS algorithm is performed on the given graph, starting from P to S (in this order only)

Now, we need to find the correct option of the DFS traversal, in terms of discovery and finish time. As it is said that graph is connected, this states that from 4 options, 3 DFS traversals will be for not-connected graph.

Call DFS for each option according to there start and Finish time.(<U,V> meaning U is starting time and V is finish time  of vertex)

1)  <(1,6) (2,5) (3,4) (8,10)>:  This option having 2 connected    component as 1/6,2/5,3/4 and 8/10 so not connected graph

2)   <(6,7) (2,5) (3,4) (8,9)>: In this graph having 3 connected component like (2/5,3/4) as one component,(6/7) is second and (8/9) is third component so it also not connected graph.

3)  <(4,5) (2,8) (1,7) (3,6)>: In this graph is connected as having single connected component as 1/8,2/7,3/6,4/5.

4) <(7,8) (1,2) (5,6) (3,4)> : graph having 4 connected component as (1/2),(3/4),(5/6),(7/8).

Only 3rd option is for connected component graph, 1,2,4 are non-connected components.

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
0 answers
3
rajveer43 asked Jan 10
57 views
The number of subgroups of a cyclic group of order 12 is ______________________
1 votes
1 votes
0 answers
4
chandan2teja asked May 27, 2019
213 views
Let A, B, C are k element sets and let S be an n element set where k<=n. How many triples of functions f:A->S, g:B->S, h:C->S are there such that f, g and h are all injec...