Voronoi diagrams, perpendicular bisectors and graph theory

IB Math AI · Geometry and Trigonometry

Building a Voronoi diagram

Given sites $A$ and $B$, every point closer to $A$ than to $B$ lies on one side of the perpendicular bisector of $AB$. That single fact generates the whole diagram: each cell is the intersection of half-planes, each edge is part of a perpendicular bisector, and each vertex is equidistant from three sites.

To find the bisector of $A(x_1,y_1)$ and $B(x_2,y_2)$: take the midpoint $M\left(\dfrac{x_1+x_2}{2},\dfrac{y_1+y_2}{2}\right)$, compute $m_{AB}$, then use gradient $-\dfrac{1}{m_{AB}}$ through $M$.

The toxic waste dump problem

"Find the point in the region that is as far as possible from every site." The answer is always either a Voronoi vertex or a point on the boundary of the region. A vertex is the centre of a circle through three sites containing no site inside — the largest empty circle in that neighbourhood. Checking every vertex and comparing radii is the whole method.

Graph theory

An adjacency matrix $M$ records edges. The $(i,j)$ entry of $M^{k}$ counts walks of length exactly $k$ from $i$ to $j$ — walks, so repeated vertices and repeated edges are allowed.

A minimum spanning tree connects all $n$ vertices using $n-1$ edges of least total weight. Kruskal: sort edges by weight, add the cheapest that does not create a cycle. Prim: grow outwards from one vertex, always taking the cheapest edge leaving the tree built so far.

An Eulerian circuit exists exactly when every vertex has even degree; with exactly two odd vertices there is an Eulerian trail between them. The Chinese postman problem repeats the cheapest pairing of odd vertices.

A(1, 2) B(7, 4) C(3, 8) V(3,5 ; 4,5) bán kính 3,54 trung trực AB trung trực AC trung trực BC y x
Each Voronoi edge is a segment of the perpendicular bisector between two stations, and each Voronoi vertex is a point equidistant from three stations. Those are the only two sentences you need to know to solve every AI Voronoi problem. The three blue lines are the perpendicular bisectors of $AB$, $AC$ and $BC$; they meet at $V(3.5\,;\,4.5)$. Since $V$ lies on the bisectors of all three pairs, $VA = VB = VC = 3.54$, and the dashed red circle centered at $V$ passes through exactly all three stations while containing no station inside. This is exactly the solution to the “toxic dump” problem: the place farthest from every station inside the survey region is a Voronoi vertex, and the greatest distance achieved is the radius of that empty circle. Notice what the figure says that the text often omits: each blue ray is only part of a perpendicular bisector. The pale dashed continuation going outward is no longer a Voronoi edge, because there a third station is closer.

Worked example: perpendicular bisectors, Voronoi cells and the location of the dump

Three transmission stations are placed at $A(1,\,2)$, $B(7,\,4)$ and $C(3,\,8)$, with units in km.

(a) Find the equation of the perpendicular bisector of $AB$. (b) Determine the coordinates of the common Voronoi vertex of the three cells. (c) A waste storage site must be placed as far from every station as possible, inside triangle $ABC$. State the location and the distance to the nearest station.

Solution

(a) The midpoint of $AB$ is $M\left(\dfrac{1+7}{2},\dfrac{2+4}{2}\right)=(4,\,3)$. The gradient

$$m_{AB}=\frac{4-2}{7-1}=\frac{2}{6}=\frac{1}{3}\;\Longrightarrow\;m_{\perp}=-3$$$$y-3=-3(x-4)\;\Longrightarrow\;y=-3x+15$$

(b) The Voronoi vertex is equidistant from all three stations so it lies on all three perpendicular bisectors; intersecting two of them is enough. Perpendicular bisector of $AC$: midpoint $(2,\,5)$, $m_{AC}=\dfrac{8-2}{3-1}=3$, so $m_{\perp}=-\dfrac13$ and

$$y-5=-\tfrac13(x-2)\;\Longrightarrow\;y=-\tfrac13 x+\tfrac{17}{3}$$

Solve the system with $y=-3x+15$:

$$-3x+15=-\tfrac13 x+\tfrac{17}{3}\;\Longrightarrow\;-\tfrac83 x=-\tfrac{28}{3}\;\Longrightarrow\;x=3.5,\quad y=-3(3.5)+15=4.5$$

So the vertex is $V(3.5\,;\,4.5)$.

Mandatory check: compute all three distances, not just two.

$$VA=\sqrt{2.5^{2}+2.5^{2}}=3.54,\quad VB=\sqrt{3.5^{2}+0.5^{2}}=3.54,\quad VC=\sqrt{0.5^{2}+3.5^{2}}=3.54$$

Three equal numbers confirm that $V$ is indeed the common vertex. If you only intersect two lines and skip this step, a small arithmetic slip in part (a) will go straight through to the final answer.

(c) Inside the triangle there is only one Voronoi vertex, so the dump goes at $V(3.5\,;\,4.5)$, $3.54$ km from each station. The circle centered at $V$ with radius $3.54$ passes through all three stations and is empty inside, so no point in the triangle is farther away than that.

Be careful to distinguish it from the centroid $\left(\dfrac{11}{3},\dfrac{14}{3}\right)\approx(3.67\,;\,4.67)$, which is the point often chosen by mistake. The distance from the centroid to $A$ is $3.80$ but to $B$ only $3.40$, so the nearest station is even closer than if placed at $V$. This problem maximizes the distance to the nearest station; it does not maximize the total distance.

Worked example: adjacency matrix and minimum spanning tree

Five villages $A$, $B$, $C$, $D$, $E$ are connected by roads with upgrade costs (unit: hundred million VND): $AB=6$, $AC=9$, $AD=12$, $BC=5$, $BD=8$, $BE=14$, $CD=7$, $CE=11$, $DE=4$.

(a) Use Kruskal's algorithm to find the minimum spanning tree and the total cost. (b) Explain why the solution must have exactly $4$ roads.

Solution

(a) Sort the edges by increasing weight: $DE=4$, $BC=5$, $AB=6$, $CD=7$, $BD=8$, $AC=9$, $CE=11$, $AD=12$, $BE=14$.

ConsideredDE (4)BC (5)AB (6)CD (7)BD (8)
Decisionacceptacceptacceptacceptreject
Reason———connects $E$creates a cycle

After accepting $DE$, $BC$, $AB$ we have two components $\{D,E\}$ and $\{A,B,C\}$. The next edge is $CD=7$: it joins two different components so it can be accepted, and at this point all five villages are connected.

$$\text{Total}=4+5+6+7=22$$

that is, $2.2$ billion VND. The edge $BD=8$ is rejected because $B$ and $D$ are by then already in the same component, and adding it would create the cycle $B\!-\!C\!-\!D\!-\!B$ without connecting any new village.

(b) A spanning tree on $n$ vertices always has exactly $n-1$ edges. With $n=5$ that is $4$. The reason: each edge accepted reduces the number of separate components by exactly one, starting from $5$ components and ending at $1$ component, so exactly $4$ edges must be accepted. Any fifth edge is certain to join two vertices that are already connected, that is, to create a cycle.

A common mistake is “take the cheapest edge at each vertex”; doing that usually gives $5$ edges and a cycle, with a total greater than $22$. It is the condition of creating no cycle that makes the algorithm, not the sorting by cost.

Common mistake

Voronoi trap number one: drawing a line perpendicular to $AB$ but passing through $A$ instead of through the midpoint. The result is still a perpendicular line that looks very much like the model figure, and every later question is thrown off with it. The midpoint step must be written on paper as its own line. Trap number two: choosing the centroid of the triangle for the dump problem. The centroid minimizes the sum of squared distances, whereas this problem maximizes the distance to the nearest station; these are two different problems, and the centroid almost always gives a worse answer. Trap number three: forgetting that the boundary of the survey region is also a candidate. If the problem frames the region with a rectangle, the farthest point may lie at a corner of the frame rather than at any Voronoi vertex. Trap number four, from graphs: reading $M^{2}$ as the number of paths with no repeats. An entry of $M^{k}$ counts walks, which may return to a previous vertex; the route $A\to B\to A$ has length $2$ and is counted in cell $(A,A)$, which is why the diagonal of $M^{2}$ is exactly the degrees of the vertices.

Key takeaway

Voronoi comes down to exactly one sentence: edges are perpendicular bisectors, vertices are equidistant from three stations, and every other question is just coordinate geometry from earlier years. Graphs come down to two sentences: $M^{k}$ counts walks, and a spanning tree has $n-1$ edges, chosen by cost but limited by the condition of creating no cycle.

← Three-dimensional solids: volume, surface area and angles · All IB Math AI lessons · Practice IB Math AI questions (free, instant scoring) · Sampling, summary statistics and outliers →