ArticleslgStudy

computer science

Seidel's algorithm

Seidel's algorithm 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 Seidel's algorithm rather than just read about it. In short: Seidel's algorithm is an algorithm designed by Raimund Seidel in 1992 for the all-pairs-shortest-path problem for undirected, unweighted, connected graphs. It solves the problem in O ( V ω log ⁡ V ) {\displaystyle O(V^{\omega }\log V)} expected time for a graph with V {\displaystyle V} vertices, where ω < 2.373 {\displaystyle \omega <2.373} is the exponent in the complexity O ( n ω ) {\displaystyle O(n^{\omega })} o…

Key takeaways

  • Seidel's algorithm 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 Seidel's algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Seidel's algorithm from memory before moving on to harder problems.

Reference excerpt

Seidel's algorithm is an algorithm designed by Raimund Seidel in 1992 for the all-pairs-shortest-path problem for undirected, unweighted, connected graphs. It solves the problem in O ( V ω log ⁡ V ) {\displaystyle O(V^{\omega }\log V)} expected time for a graph with V {\displaystyle V} vertices, where ω < 2.373 {\displaystyle \omega <2.373} is the exponent in the complexity O ( n ω ) {\displaystyle O(n^{\omega })} of n × n {\displaystyle n\times n} matrix multiplication. If only the distances between each pair of vertices are sought, the same time bound can be achieved in the worst case. Even though the algorithm is designed for connected graphs, it can be applied individually to each connected component of a graph with the same running time overall. There is an exception to the expected running time given above for computing the paths: if ω = 2 {\displaystyle \omega =2} the expected running time becomes O ( V 2 log 2 ⁡ V ) {\displaystyle O(V^{2}\log ^{2}V)} .

Details of the implementation The core of the algorithm is a procedure that computes the length of the shortest-paths between any pair of vertices. In the worst case this can be done in O ( V ω log ⁡ V ) {\displaystyle O(V^{\omega }\log V)} time. Once the lengths are computed, the paths can be reconstructed using a Las Vegas algorithm whose expected running time is O ( V ω log ⁡ V ) {\displaystyle O(V^{\omega }\log V)} for ω > 2 {\displaystyle \omega >2} and O ( V 2 log 2 ⁡ V ) {\displaystyle O(V^{2}\log ^{2}V)} for ω = 2 {\displaystyle \omega =2} .

Computing the shortest-paths lengths The Python code below assumes the input graph is given as a n × n {\displaystyle n\times n} 0 {\displaystyle 0} - 1 {\displaystyle 1} adjacency matrix A {\displaystyle A} with zeros on the diagonal. It defines the function APD which returns a matrix with entries D i , j {\displaystyle D_{i,j}} such that D i , j {\displaystyle D_{i,j}} is the length of the shortest path between the vertices i {\displaystyle i} and j {\displaystyle j} . The matrix class used can be any matrix class implementation supporting the multiplication, exponentiation, and indexing operators (for example numpy.matrix).

The base case tests whether the input adjacency matrix describes a complete graph, in which case all shortest paths have length 1 {\displaystyle 1} .

Graphs with weights from finite universes Algorithms for undirected and directed graphs with weights from a finite universe { 1 , … , M , + ∞ } {\displaystyle \{1,\ldots ,M,+\infty \}} also exist. The best known algorithm for the directed case is in time O ~ ( M 1 / ( 4 − ω ) V 2 + 1 / ( 4 − ω ) ) {\displaystyle {\tilde {O}}(M^{1/(4-\omega )}V^{2+1/(4-\omega )})} by Zwick in 1998. This algorithm uses rectangular matrix multiplication instead of square matrix multiplication. Better upper bounds can be obtained if one uses the best rectangular matrix multiplication algorithm available instead of achieving rectangular multiplication via multiple square matrix multiplications. The best known algorithm for the undirected case is in time O ~ ( M V ω ) {\displaystyle {\tilde {O}}(MV^{\omega })} by Shoshan and Zwick in 1999. The original implementation of this algorithm was erroneous and has been corrected by Eirinakis, Williamson, and Subramani in 2016.

Notes

Worked examples

Example 1 — a first encounter with Seidel's algorithm

Start with the simplest possible case. Write down what Seidel's algorithm 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 Seidel's algorithm 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 Seidel's algorithm 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 Seidel's algorithm

In research
Seidel's algorithm 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 Seidel's algorithm 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
Seidel's algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computational problems in graph theory, Graph algorithms, Graph distance, so understanding it makes those chapters shorter.
In everyday life
Look for Seidel's algorithm 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 “Seidel's algorithm” →

Affiliate

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

How to study Seidel's algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Seidel's algorithm 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 Seidel's algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Seidel's algorithm in simple terms?

Seidel's algorithm is an algorithm designed by Raimund Seidel in 1992 for the all-pairs-shortest-path problem for undirected, unweighted, connected graphs. It solves the problem in O ( V ω log ⁡ V ) {\displaystyle O(V^{\omega }\log V)} expected time for a graph with V {\displaystyle V} vertices, wh…

Why does Seidel's algorithm 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 Seidel's algorithm?

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 Seidel's algorithm.

Tags

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

Keep exploring