Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Given a directed graph where weight of every ... Start Learning for Free
Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?
  • a)
    Breadth First Traversal
  • b)
    Dijkstra's Shortest Path Algorithm
  • c)
    Neither Breadth First Traversal nor Dijkstra's algorithm can be used
  • d)
    Depth First Search
Correct answer is option 'A'. Can you explain this answer?
Verified Answer
Given a directed graph where weight of every edge is same, we can effi...
With BFS, we first find explore vertices at one edge distance, then all vertices at 2 edge distance, and so on.
View all questions of this test
Most Upvoted Answer
Given a directed graph where weight of every edge is same, we can effi...
Breadth First Traversal is the correct option.

Explanation:
Breadth First Traversal (BFS) can be used to find the shortest path in a directed graph where the weight of every edge is the same. BFS explores all the vertices of a graph in a level-by-level manner, starting from the source vertex. It visits all the vertices that are at a distance of 1 from the source, then visits all the vertices that are at a distance of 2, and so on.

Steps to find the shortest path using BFS:
1. Start BFS traversal from the source vertex.
2. Maintain a queue to store the vertices to be visited. Enqueue the source vertex.
3. Maintain a visited array to keep track of the visited vertices.
4. Initialize the visited array with false for all vertices except the source vertex.
5. While the queue is not empty, do the following steps:
a. Dequeue a vertex from the queue.
b. If the dequeued vertex is the destination vertex, then the shortest path is found.
c. Otherwise, enqueue all the adjacent vertices of the dequeued vertex that are not visited yet.
d. Mark the dequeued vertex as visited.
6. If the destination vertex is not reached after the BFS traversal, then there is no path from the source to the destination.

Why BFS is efficient in this case?
In a directed graph with the same weight on every edge, BFS guarantees finding the shortest path from the source to the destination vertex. This is because BFS visits the vertices in a level-by-level manner, exploring all the vertices at distance 1 before moving on to vertices at distance 2, and so on. Since the weight of every edge is the same, the path with fewer edges will always be the shortest path.

Example:
Consider a graph with vertices A, B, C, D, and E, where edges are directed and have a weight of 1. Let the source vertex be A and the destination vertex be D. The graph can be represented as:
```
A -> B
A -> C
B -> C
B -> D
C -> D
C -> E
```
Using BFS, the shortest path from A to D can be found as: A -> B -> D.

Hence, Breadth First Traversal is an efficient way to find the shortest path in a directed graph with the same weight on every edge.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer?
Question Description
Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer?.
Solutions for Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using?a)Breadth First Traversalb)Dijkstras Shortest Path Algorithmc)Neither Breadth First Traversal nor Dijkstras algorithm can be usedd)Depth First SearchCorrect answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev