Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Which of the following algorithm can be used ... Start Learning for Free
Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?
  • a)
    Dijkstra
  • b)
    Bellman-Ford
  • c)
    Topological Sort
  • d)
    Strongly Connected Component
Correct answer is option 'C'. Can you explain this answer?
Most Upvoted Answer
Which of the following algorithm can be used to efficiently calculate ...
Understanding Shortest Path Algorithms in DAGs
In a Directed Acyclic Graph (DAG), the single-source shortest path problem can be efficiently solved by leveraging the properties of the graph. Among the options provided, the correct choice is:
Topological Sort
Why Topological Sort?
- DAG Properties: A DAG is a directed graph with no cycles. This allows for a linear ordering of its vertices, known as topological ordering.
- Process of Topological Sort:
- Perform a topological sort on the DAG to obtain a linear ordering of vertices.
- This ordering ensures that for any directed edge (u, v), vertex u comes before vertex v.
- Relaxation of Edges:
- Start from the source vertex and initialize its distance to zero, while all other vertices are set to infinity.
- Traverse the vertices in topological order and relax all outgoing edges of the current vertex. This means updating the distance of each adjacent vertex if a shorter path is found.
Efficiency
- Time Complexity: The topological sort can be performed in O(V + E) time, where V is the number of vertices and E is the number of edges. The relaxation step also takes O(V + E) time.
- Overall: The combined complexity remains O(V + E), making it efficient for single-source shortest path calculations in DAGs.
Comparison with Other Algorithms
- Dijkstra's Algorithm: Best for graphs with non-negative weights, but not optimal for DAGs.
- Bellman-Ford Algorithm: Handles negative weights, but is less efficient (O(VE)).
- Strongly Connected Components: Not applicable for finding shortest paths directly.
In summary, using topological sorting in a DAG provides a clear and efficient method to solve the single-source shortest path problem.
Free Test
Community Answer
Which of the following algorithm can be used to efficiently calculate ...
Using Topological Sort, we can find single source shortest paths in O(V+E) time which is the most efficient algorithm. See following for details. Shortest Path in Directed Acyclic Graph
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Question Description
Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 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 Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. Can you explain this answer?.
Solutions for Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. 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 Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. Can you explain this answer?, a detailed solution for Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. Can you explain this answer? has been provided alongside types of Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph?a)Dijkstrab)Bellman-Fordc)Topological Sortd)Strongly Connected ComponentCorrect answer is option 'C'. 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