ArticleslgStudy

computer science

K shortest path routing

K shortest path routing is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand K shortest path routing rather than just read about it. In short: The k shortest path routing problem is a generalization of the shortest path routing problem in a given network. It asks not only about a shortest path but also about next k−1 shortest paths (which may be longer than the shortest path).

K shortest path routing — main illustration
K shortest path routing — illustration

Key takeaways

  • K shortest path routing belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect K shortest path routing to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of K shortest path routing from memory before moving on to harder problems.

Reference excerpt

The k shortest path routing problem is a generalization of the shortest path routing problem in a given network. It asks not only about a shortest path but also about next k−1 shortest paths (which may be longer than the shortest path). A variation of the problem is the loopless k shortest paths. Finding k shortest paths is possible by extending Dijkstra's algorithm or the Bellman-Ford algorithm.

History Since 1957, many papers have been published on the k shortest path routing problem. Most of the fundamental works were done between 1960s and 2001. Since then, most of the research has been on the problem's applications and its variants. In 2010, Michael Günther et al. published a book on Symbolic calculation of k-shortest paths and related measures with the stochastic process algebra tool CASPA.

Algorithm Dijkstra's algorithm can be generalized to find the k shortest paths.

Variations There are two main variations of the k shortest path routing problem. In one variation, paths are allowed to visit the same node more than once, thus creating loops. In another variation, paths are required to be simple and loopless. The loopy version is solvable using Eppstein's algorithm and the loopless variation is solvable by Yen's algorithm.

Loopy variant In this variant, the problem is simplified by not requiring paths to be loopless. A solution was given by B. L. Fox in 1975 in which the k-shortest paths are determined in O(m + kn log n) asymptotic time complexity (using big O notation). In 1998, David Eppstein reported an approach that maintains an asymptotic complexity of O(m + n log n + k) by computing an implicit representation of the paths, each of which can be output in O(n) extra time. In 2015, Akiba et al. devised an indexing method as a significantly faster alternative for Eppstein's algorithm, in which a data structure called an index is constructed from a graph and then top-k distances between arbitrary pairs of vertices can be rapidly obtained.

Loopless variant In the loopless variant, the paths are forbidden to contain loops, which adds an additional level of complexity. It can be solved using Yen's algorithm to find the lengths of all shortest paths from a fixed node to all other nodes in an n-node non negative-distance network, a technique requiring only 2n2 additions and n2 comparison, fewer than other available shortest path algorithms need. The running time complexity is pseudo-polynomial, being O(kn(m + n log n)) (where m and n represent the number of edges and vertices, respectively). In 2007, John Hershberger and Subhash Suri proposed a replacement paths algorithm, a more efficient implementation of Lawler's and Yen's algorithm with O(n) improvement in time for a large number of graphs, but not all of them (therefore not changing the asymptotic bound of Yen's algorithm).

Some examples and description

Example 1 The following example makes use of Yen's model to find k shortest paths between communicating end nodes. That is, it finds a shortest path, second shortest path, etc. up to the Kth shortest path. More details can be found here. The code provided in this example attempts to solve the k shortest path routing problem for a 15-nodes network containing a combination of unidirectional and bidirectional links:

Example 2 Another example is the use of k shortest paths algorithm to track multiple objects. The technique implements a multiple object tracker based on the k shortest paths routing algorithm. A set of probabilistic occupancy maps is used as input. An object detector provides the input. The complete details can be found at "Computer Vision Laboratory – CVLAB".

Example 3 Another use of k shortest paths algorithms is to design a transit network that enhances passengers' experience in public transportation systems. Such an example of a transit network can be constructed by putting traveling time under consideration. In addition to traveling time, other conditions may be taken depending upon economical and geographical limitations. Despite variations in parameters, the k shortest path algorithms finds the most optimal solutions that satisfies almost all user needs. Such applications of k shortest path algorithms are becoming common, recently Xu, He, Song, and Chaudhry (2012) studied the k shortest path problems in transit network systems.

Applications The k shortest path routing is a good alternative for:

Geographic path planning Network routing, especially in optical mesh network where there are additional constraints that cannot be solved by using ordinary shortest path algorithms. Hypothesis generation in computational linguistics Sequence alignment and metabolic pathway finding in bioinformatics Multiple object tracking as described above Road Networks: road junctions are the nodes (vertices) and each edge (link) of the graph is associated with a road segment between two junctions.

Related problems The breadth-first search algorithm is used when the search is only limited to two operations. The Floyd–Warshall algorithm solves all pairs shortest paths. Johnson's algorithm solves all pairs' shortest paths, and may be faster than Floyd–Warshall on sparse graphs. Perturbation theory finds (at worst) the locally shortest path. Cherkassky et al. provide more algorithms and associated evaluations.

See also Constrained shortest path routing

Notes

External links Implementation of Yen's algorithm Implementation of Yen's and fastest k shortest simple paths algorithms http://www.technical-recipes.com/2012/the-k-shortest-paths-algorithm-in-c/#more-2432 Multiple objects tracking technique using K-shortest path algorithm: http://cvlab.epfl.ch/software/ksp/ Computer Vision Laboratory: http://cvlab.epfl.ch/software/ksp/

Worked examples

Example 1 — a first encounter with K shortest path routing

Start with the simplest possible case. Write down what K shortest path routing claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to K shortest path routing before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about K shortest path routing ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of K shortest path routing

In research
K shortest path routing appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses K shortest path routing in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
K shortest path routing is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational problems in graph theory, Graph algorithms, Network theory, so understanding it makes those chapters shorter.
In everyday life
Look for K shortest path routing outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “K shortest path routing” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study K shortest path routing in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what K shortest path routing means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain K shortest path routing out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is K shortest path routing in simple terms?

The k shortest path routing problem is a generalization of the shortest path routing problem in a given network. It asks not only about a shortest path but also about next k−1 shortest paths (which may be longer than the shortest path).

Why does K shortest path routing matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study K shortest path routing?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on K shortest path routing.

Tags

  • Computational problems in graph theory
  • Graph algorithms
  • Network theory
  • Polynomial-time problems

Keep exploring