ArticleslgStudy

computer science

Fortune's algorithm

Fortune'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 Fortune's algorithm rather than just read about it. In short: Fortune's algorithm is a sweep line algorithm for generating a Voronoi diagram from a set of points in a plane using O(n log n) time and O(n) space. It was originally published by Steven Fortune in 1986 in his paper "A sweepline algorithm for Voronoi diagrams." Algorithm description The algorithm maintains both a sweep line and a beach line, which both move through the plane as the algorithm progresses.

Fortune's algorithm — main illustration
Fortune's algorithm — illustration

Key takeaways

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

Reference excerpt

Fortune's algorithm is a sweep line algorithm for generating a Voronoi diagram from a set of points in a plane using O(n log n) time and O(n) space. It was originally published by Steven Fortune in 1986 in his paper "A sweepline algorithm for Voronoi diagrams."

Algorithm description The algorithm maintains both a sweep line and a beach line, which both move through the plane as the algorithm progresses. The sweep line is a straight line, which we may by convention assume to be vertical and moving left to right across the plane. At any time during the algorithm, the input points left of the sweep line will have been incorporated into the Voronoi diagram, while the points right of the sweep line will not have been considered yet. The beach line is not a straight line, but a complicated, piecewise curve to the left of the sweep line, composed of pieces of parabolas; it divides the portion of the plane within which the Voronoi diagram can be known, regardless of what other points might be right of the sweep line, from the rest of the plane. For each point left of the sweep line, one can define a parabola of points equidistant from that point and from the sweep line; the beach line is the boundary of the union of these parabolas. As the sweep line progresses, the vertices of the beach line, at which two parabolas cross, trace out the edges of the Voronoi diagram. The beach line progresses by keeping each parabola base exactly halfway between the points initially swept over with the sweep line, and the new position of the sweep line. Mathematically, this means each parabola is formed by using the sweep line as the directrix and the input point as the focus. The algorithm maintains as data structures a binary search tree describing the combinatorial structure of the beach line, and a priority queue listing potential future events that could change the beach line structure. These events include the addition of another parabola to the beach line (when the sweep line crosses another input point) and the removal of a curve from the beach line (when the sweep line becomes tangent to a circle through some three input points whose parabolas form consecutive segments of the beach line). Each such event may be prioritized by the x-coordinate of the sweep line at the point the event occurs. The algorithm itself then consists of repeatedly removing the next event from the priority queue, finding the changes the event causes in the beach line, and updating the data structures. As there are O(n) events to process (each being associated with some feature of the Voronoi diagram) and O(log n) time to process an event (each consisting of a constant number of binary search tree and priority queue operations) the total time is O(n log n).

Pseudocode Pseudocode description of the algorithm.

let ∗(z) be the transformation ∗(z)=(zx,zy+d(z)), where d(z) is the Euclidean distance between z and the nearest site let T be the "beach line" let Rp be the region covered by site p. let Cpq be the boundary ray between sites p and q. let S be a set of sites on which this algorithm is to be applied. let p1,p2,...,pm be the sites extracted from S with minimal y-coordinate, ordered by x-coordinate let DeleteMin(X) be the act of removing the lowest and leftmost site of X (sort by y unless they're identical, in which case sort by x) let V be the Voronoi map of S which is to be constructed by this algorithm Q←p1,p2,…,pm,S create initial vertical boundary rays Cp1,p20,Cp2,p30,…,Cpm−1,pm0 T←∗(Rp1),Cp1,p20,∗(Rp2),Cp2,p30,…,∗(Rpm−1),Cpm−1,pm0,∗(Rpm)

while not IsEmpty(Q) do p ← DeleteMin(Q) case p of p is a site in ∗(V): find the occurrence of a region ∗(Rq) in T containing p, bracketed by Crq on the left and Cqs on the right create new boundary rays Cpq− and Cpq+ with bases p replace ∗(Rq) with ∗(Rq),Cpq−,∗(Rp),Cpq+,∗(Rq) in T delete from Q any intersection between Crq and Cqs insert into Q any intersection between Crq and Cpq− insert into Q any intersection between Cpq+ and Cqs p is a Voronoi vertex in ∗(V): let p be the intersection of Cqr on the left and Crs on the right let Cuq be the left neighbor of Cqr and let Csv be the right neighbor of Crs in T if qy=sy, create a new boundary ray Cqs0 else if p is right of the higher of q and s, create Cqs+ else create Cqs− endif replace Cqr,∗(Rr),Crs with newly created Cqs in T delete from Q any intersection between Cuq and Cqr delete from Q any intersection between Crs and Csv insert into Q any intersection between Cuq and Cqs insert into Q any intersection between Cqs and Csv record p as the summit of Cqr and Crs and the base of Cqs output the boundary segments Cqr and Crs endcase endwhile

output the remaining boundary rays in T

Weighted sites and disks

Additively weighted sites As Fortune describes in ref., a modified version of the sweep line algorithm can be used to construct an additively weighted Voronoi diagram, in which the distance to each site is offset by the weight of the site; this may equivalently be viewed as a Voronoi diagram of a set of disks, centered at the sites with radius equal to the weight of the site. the algorithm is found to have O(nlog⁡(n)) time complexity with n being the number of sites according to ref. Weighted sites may be used to control the areas of the Voronoi cells when using Voronoi diagrams to construct treemaps. In an additively weighted Voronoi diagram, the bisector between sites is in general a hyperbola, in contrast to unweighted Voronoi diagrams and power diagrams of disks for which it is a straight line.

References

External links Steven Fortune's C implementation Fortune's Voronoi algorithm implemented in C++ Fortune's algorithm implemented in JavaScript archived on GitHub as of August 2015 Fortune's Algorithm Visualization as of 2025 access is blocked

Illustrations

Fortune's algorithm: Fortune's algorithm animation
Fortune's algorithm animation

Worked examples

Example 1 — a first encounter with Fortune's algorithm

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

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

How to study Fortune's algorithm in 20 minutes

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

Frequently asked questions

What is Fortune's algorithm in simple terms?

Fortune's algorithm is a sweep line algorithm for generating a Voronoi diagram from a set of points in a plane using O(n log n) time and O(n) space. It was originally published by Steven Fortune in 1986 in his paper "A sweepline algorithm for Voronoi diagrams." Algorithm description The algorithm m…

Why does Fortune'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 Fortune'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 Fortune's algorithm.

Tags

  • Geometric algorithms

Keep exploring