You are given a directed-acyclic-graph G = (V,E) with possibly negative weighted edges: (a) Give an algorithm that finds the length of the shortest path that contains at most k edges between two vertices u and v in O(k(n+m)) time. (b) Give an algorithm that finds the length of the shortest path that contains exactly k edges between two vertices u and v in O(k(n+m)) time. Hint: You can solve both problems almost the same way. Modify the graph G and utilize the algorithm from problem 2 part (a).
You are given a directed-acyclic-graph G = (V,E) with possibly negative weighted edges: (a) Give an algorithm that finds the length of the shortest path that contains at most k edges between two vertices u and v in O(k(n+m)) time. (b) Give an algorithm that finds the length of the shortest path that contains exactly k edges between two vertices u and v in O(k(n+m)) time. Hint: You can solve both problems almost the same way. Modify the graph G and utilize the algorithm from problem 2 part (a).
Related questions
Question
Algorithms
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps