
com.barrybecker4.discreteoptimization.kshortestpaths.solver.KShortestPathsSolver.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bb4-shortest-paths Show documentation
Show all versions of bb4-shortest-paths Show documentation
bb4-shortest-paths java code.
The newest version!
package com.barrybecker4.discreteoptimization.kshortestpaths.solver
import com.barrybecker4.discreteoptimization.common.graph.directed.DirectedGraph
import com.barrybecker4.discreteoptimization.kshortestpaths.model.KShortestPathsSolution
/**
* See https://en.wikipedia.org/wiki/K_shortest_path_routing
* There are 2 main variants
* - Yen's algorithm - built on Dijkstra's shortest path algorithm. Find's k shortest loopless paths
* - Eppstein's algorithm - built on Dijkstra's shortest path algorithm. Find's k shortest paths (allowing loops)
* see https://codeforces.com/blog/entry/102085
* - Hershbergers algorthm - faster than Yen's - see https://archive.siam.org/meetings/alenex03/Abstracts/jhershberger.pdf
*
* For visualization look at
* - JGraphT - https://jgrapht.org/ - generate viz and save as images
* - GraphStream - https://graphstream-project.org/
*/
trait KShortestPathsSolver {
def findPaths(graph: DirectedGraph, source: Int, destination: Int, k: Int): KShortestPathsSolution
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy