Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Melanie is a second - year computer science student currently studying at Griffith School of ICT. One day, Melanie s father came to her and
Melanie is a secondyear computer science student currently studying at Griffith School of ICT. One day,
Melanies father came to her and told her that he wants to travel from Southport to Brisbane CBD and asks
Melanie to recommend exactly shortest loopless paths for some reason. Luckily, Melanie is undertaking
the ICT: Computing Algorithms course. Though, Melanie knows both Dijkstras algorithm and
Bellman Fords algorithm very well as these two algorithms have been taught already in the class, she is
not exactly sure how to solve this shortest loopless paths problem for the Queensland road network
graph. This is an interesting problem and it could be solved by the following requirement. Melanies father
is happy if and only if the first recommended path is the shortest path between Southport to Brisbane
CBD and the rest of the paths are approximated shortest paths as these paths are his backup
paths.
Problem Description
The shortest path problem is about finding a path between vertices in a graph such that the total sum of
the edges weights is minimum. This problem could be solved easily using BFS if all edge weights were
but here weights can take any value. There are TWO popular algorithms in the literature for computing
the shortest paths from the source vertex to all other vertices in a graph: i Dijkstra's Algorithm; and ii
Bellman Fords Algorithm. The Bellman Fords algorithm exploits the idea that a shortest path contains at
most edges, and a shortest path cannot have a cycle. The Bellman Fords algorithm works for graphs
with negative weight cycles The time complexity of Dijkstra's Algorithm with minpriority queue is
log On the other hand, the time complexity of Bellman Ford algorithm is relatively high
in case
Both Dijkstra's and Bellman Fords algorithms unable to solve the this
shortest loopless paths KSP problem. There exist many works in the literature to solve KSP problem.
Some useful references are given at the end of this document.
In this problem, you are given integers is the number of vertices, is the number of edges.
You will also be given where and represents an edge from a vertex to a vertex and
respresents the weight of that edge. Finally, you will be given two vertices and where denotes the
source vertex Southport and denotes the destination vertex Brisbane CBD and the value of
For each input file, print the length of the shortest loopless paths separated by commas and these paths
must include the shortest path between and and the rest of the paths are approximated
shortest paths.
Sample Input: Consider the following directed graph as an example.
C D
C E
D F
E D
E F
E G
F G
F H
G H
C H
Sample Output:
The shortest paths from source C to destination H are as follows:
P CEFH Cost P
P CEGH Cost P
P CDFH Cost P
Sample Results for Java Implementation Yen Algorithm
Input k Output CPU Time millisecs
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started