R icon indicating copy to clipboard operation
R copied to clipboard

Yen k shortest paths

Open ArpitaHanjagi opened this issue 2 months ago • 1 comments

Algorithm: Yen's K Shortest Paths

Purpose: Finds the K shortest loopless paths between a source and target in a weighted directed graph.

Theory:

Starts with the shortest path using Dijkstra.

Iteratively generates alternative paths by deviating from previous paths.

Avoids cycles in paths.

Time Complexity: O(K * V * (V + E) * log V) with Dijkstra for each deviation.

Space Complexity: O(K * V).

Input: Weighted directed graph (adjacency list), source, target, K.

Output: List of K paths and their total distances.

ArpitaHanjagi avatar Oct 20 '25 19:10 ArpitaHanjagi

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 26 '25 00:11 github-actions[bot]

This PR was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Dec 04 '25 00:12 github-actions[bot]