The Gateway to Computer Science Excellence
0 votes
169 views

Which of the following statement is true?

  1. For a directed graph, the absence of back edges in a DFS tree can have cycle.
  2. If all edge in a graph have distinct weight then the shortest path between two vertices is unique.
  3. The depth of any DFS (Depth First Search) tree rooted at a vertex is atleast as depth of any BFS tree rooted at the same vertex.
  4. Both (a) and (c)
in Algorithms by (107 points)
edited by | 169 views

2 Answers

+1 vote
I think the correct answer is option c.

Because if a DFS traversal graph consists of a back edge then it has a cycle. and option a is mentioning just the opposite.

And 2 paths can have the same length like 7+3=10 and 6+4=10.
by (233 points)
0
what about forward edge ? we can make cycle with na ...... backedge is sufficent but not necessary
+1
A graph has a cycle if and only if there is a back edge.

A forward edge can never lead to a cycle.
0
okk okkk i m wrong there directions are not in cycle form
0 votes
1. A directed graph can have cycle only when it has back edge in DFS tree. So it is FALSE.

2. The distance between two vertices may be same using the different paths. Also, no of edges in those paths may vary. So this statement is also FALSE.

3. BFS distance from source is the minimum number of edges to reach the target node. In DFS, the depth of any node will surely be greater than or equal to minimum number of edges from the source. Hence, this statement is TRUE.
by (137 points)
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,645 questions
56,616 answers
195,897 comments
102,357 users