In Java Language Let G = (V,E) be a graph representing a communication network i
ID: 3580982 • Letter: I
Question
In Java Language
Let G = (V,E) be a graph representing a communication network in which the edges are labelled either slow or fast. Describe an algorithm for nding a path from vertex s to vertex t with the smallest number of slow edges (it does not matter how many fast edges there are in the path as long as the number of slow edges is as small as possible).
( You do not have to write full descriptions of the algorithms. Just indicate which algorithm you would use, and which changes you need to make to the algorithm to answer each question. Indicate also how to pre-process the input for the algorithm. )
Explanation / Answer
You can use Dijkstra's algorithm to find the shortest path, and instread of weight you can have string inputs like "fast" or "slow", or you can have binary 1 or 0 as weights, to indicate fast or slow path. Rest of the algorithm remains the same.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.