0% found this document useful (0 votes)
26 views

Group 1's Assignment: Welcome To Our

The document summarizes an approach to finding the k-th shortest path between two nodes in a directed weighted graph without loops using Yen's algorithm. Yen's algorithm exploits the fact that the k-th and (k-1)-th shortest paths share common edges. It works by finding the (k-1)-th shortest path, then removing edges from this path to find new paths and selecting the shortest new path as the k-th shortest path. Pseudocode is provided to illustrate the iterative process of removing edges and finding unique paths.

Uploaded by

khoa Truong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Group 1's Assignment: Welcome To Our

The document summarizes an approach to finding the k-th shortest path between two nodes in a directed weighted graph without loops using Yen's algorithm. Yen's algorithm exploits the fact that the k-th and (k-1)-th shortest paths share common edges. It works by finding the (k-1)-th shortest path, then removing edges from this path to find new paths and selecting the shortest new path as the k-th shortest path. Pseudocode is provided to illustrate the iterative process of removing edges and finding unique paths.

Uploaded by

khoa Truong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Group 1’s

assignment

Welcome to our
report
Table of
Contents
Team members and workload
01 Some information about our
group members and work
contribution

Problem & Solution


02 Solutions to given problems
01
Team
Presentation and workload
Your logo

Big work.Co Tm
Big work.Co Tm .
Our group’s named

There are 5 members :

1. Trương Huỳnh Đăng


Kth shortest path without loop

The shortest path algorithm, perhaps


one of the most fundamental problems
of graph theory, a stepping stone to
countless applications in practice. In
this project, however, we take a little
twist by researching the k-th shortest
path. Given any directed weighted
graph, it is our job to find the k-th
shortest path between two given nodes
without conducting a loop.
Shortest path without loop
We are already familiar with the
shortest path problem through
popular algorithms like Bellman-
Ford, Dijkstra and Floyd-
Warshall.

Dijkstra Bellman-Ford Floyd-Warshall


Shortest path from one Shortest path form one Shortest path beween all
node to another node to another pairs of nodes
Time complexity: O(VxE) Time complexity: O(V Time complexity: O(n^3)
(V: vertices, E: edges) + ElogV) Works on negative edges
Does not work on negative Works on negative
weighted edges edges
Yen’s Algorithm

One of the ways to solve the kth-shortest


path without loop problem is Yen’s
Algorithm.

The idea is simple: It exploits the fact


that there are going to be common edges
between the kth and the (k-1)th shortest
path.
The idea in detail
Remove an edge in the (k-1)th
Find the shortest path shortest path and find new paths
using any viable that travels from source to sink
algorithm

Step Step Step


Step 1
2 3 4

To find the k-th shortest Repeat the process for every


path, it is assumed that node in the (k-1)th shortest
you have already found path, then check the new
the (k-1)th shortest path paths for the shortest one
How to make it work?
First we create two arrays A and
Then we iterarte through the first
B to store paths as each element.
node to the one before last of the (k-
We then find the shortest path
1)th shortest path. For each iterations,
(k=1) and save that path to A[0]
we remove the edge between the
current node (i) and the next node of
that path. Next we find the shortest
path from (i+1)th node to the
destination, then append that path
Check all the path in array B
with the path going from the origin to
and select the one with the
the i-th node
least weight and add it to A,
that will be the k-th shortest
path. Add the newly constructed node to array B. Repeat
the loop so that each node in the (k-1)th shortest
path checks for all possible unique path whenever
we remove the edge(s) connecting it to the next
node
Please press Slide Show for the gif to play

You might also like