Using Voronoi Diagrams and Graph Theory To Optimize University Options.
Using Voronoi Diagrams and Graph Theory To Optimize University Options.
Table of Contents
Introduction: ............................................................................................................................. 1
Rationale: .......................................................................................................................................... 1
Aim: ................................................................................................................................................... 1
r
.c
ed
Exploration: .............................................................................................................................. 2
y.
lle
Construction of the Voronoi Diagram: ........................................................................................... 2
va
en
Analysis of the Voronoi Diagram: ................................................................................................... 7
ld
go
Bibliography ............................................................................................................................ 17
.h
es
m
ja
y
tif
as
Cl
Downloaded from www.clastify.com by James Hronek Rojas
Introduction:
Rationale:
As an IBDP student in my final year of high school, I have a major life-changing decision to
make, which is deciding on the universities I want to apply to that would be best suited to
Personally, there are numerous factors I consider when trying to make this critical decision,
such as my academic level, university rankings, student population, diversity rates, and so on.
r
.c
However, out of all these important factors, location is the most significant to me. In 2017, I
ed
y.
moved to Houston, Texas, with my family, and I've felt at home there ever since, so it is in my
lle
best interest to apply to a university close to my family in Houston. Additionally, I've been a
va
en
lifelong Houston Rockets fan, even twice visiting their home stadium, the Toyota Center, to
ld
go
watch them play live. As I'm moving into university, it would be my preferred decision to apply
k@
to the school nearest the Toyota Center, so I can watch the Houston Rockets play in live time
ne
ro
more often. Furthermore, it is important for me to understand and have a feel for each university
.h
es
I want to apply to, so I would also like to visit every university campus in the vicinity of the
m
ja
Toyota Center. And, since fuel prices continue to rise in the US, I would like to save fuel by
y
tif
Aim:
This investigation aims to use a Voronoi Diagram to determine the optimal university based
on which of the five shortlisted universities is nearest the Toyota Center. Solely based on
intuition and inspection, I would predict the University of Houston-Downtown would be the
closest university to the Toyota Center. Nevertheless, a Voronoi Diagram would still be
necessary to validate this prediction. Moreover, this investigation presents this scenario as a
traveling salesman problem to calculate an approximate solution for the Hamiltonian cycle of
1
Downloaded from www.clastify.com by James Hronek Rojas
least weight by utilizing a weighted graph that displays the distance of the shortest routes that
link the five universities. This helps reduce fuel consumption while visiting each university
once for a campus tour. Although a range of values can be found by calculating the lower and
upper bounds for the Hamiltonian cycle of least weight, it is important to note that no effective
algorithm has been developed to perfectly solve the traveling salesman problem, so any
Exploration:
r
.c
ed
Construction of the Voronoi Diagram:
y.
lle
A Voronoi Diagram is “the partitioning of a plane with n points into convex polygons such that
va
en
each polygon contains exactly one generating point and every point in a given polygon is closer
ld
go
to its generating point than to any other.”1 In order to construct a Voronoi Diagram, I first
k@
overlayed a map from Google Earth of the five closest universities to the Toyota Center over a
ne
ro
cyan squared grid using GeoGebra. This results in the creation of the coordinate system, which
.h
es
is “an arrangement of reference lines or curves used to identify the location of points in space.”2
m
ja
The coordinate system is illustrated in figure 1 below, which has a scale of 2000 meters per 2
y
tif
units and displays the five shortlisted universities as different sites (𝑅, 𝑆, 𝐷, 𝑇, 𝐻) as well as the
as
Toyota Center, which is marked as point 𝑇𝐶. The coordinates of all five university sites present
Cl
1
Weisstein, E.W. (2021). Voronoi Diagram. [online] mathworld.wolfram.com. Available at:
https://mathworld.wolfram.com/VoronoiDiagram.html.
2
Encyclopedia Britannica. (n.d.). Coordinate system | mathematics. [online] Available at:
https://www.britannica.com/science/coordinate-system.
2
Downloaded from www.clastify.com by James Hronek Rojas
r
.c
ed
y.
lle
va
en
ld
go
k@
ne
ro
𝑥
.h
es
3
Downloaded from www.clastify.com by James Hronek Rojas
A perpendicular bisector is “a line that divides a given line segment exactly into two halves
forming 90 degrees angle at the intersection point.”3 All points on a perpendicular bisector are
equidistant to the sites they are bisecting, and the perpendicular bisector helps divide the plane
into two regions. Therefore, finding the perpendicular bisectors between every site is essential
in the construction of a Voronoi Diagram, as they will serve as the edges of the Voronoi
Diagram.
Firstly, the edge between sites 𝑅 (0.92, 1.39) and 𝑆 (1.71, 3.52) was constructed.
r
.c
ed
In order to find the equation of the perpendicular bisector between these two sites the midpoint
y.
lle
was calculated first, as shown below:
va
𝑥1 + 𝑥2 𝑦1 + 𝑦2
en
𝑀𝑖𝑑𝑝𝑜𝑖𝑛𝑡 𝑜𝑓 [𝑅𝑆] = ( , )
2 2
ld
go
2 2
ne
= (1.315, 2.455)
ro
.h
es
m
The gradient of the perpendicular bisector between sites 𝑅 and 𝑆 is equal to the negative
ja
y
reciprocal of the gradient (𝑚) of the line segment between these points.
tif
as
𝑦2 − 𝑦1
𝑚 𝑜𝑓 [𝑅𝑆] =
Cl
𝑥2 − 𝑥1
3.52 − 1.39
=
1.71 − 0.92
2.13 213
𝑚 𝑜𝑓 [𝑅𝑆] = =
0.79 79
𝟕𝟗
∴ 𝑮𝒓𝒂𝒅𝒊𝒆𝒏𝒕 𝒐𝒇 𝑷𝒆𝒓𝒑𝒆𝒏𝒅𝒊𝒄𝒖𝒍𝒂𝒓 𝑩𝒊𝒔𝒆𝒄𝒕𝒐𝒓 𝒐𝒇 [𝑹𝑺] = −
𝟐𝟏𝟑
3
Cuemath. (n.d.). Perpendicular Bisector - Definition, Construction, Properties, Examples. [online] Available
at: https://www.cuemath.com/geometry/perpendicular-bisectors/.
4
Downloaded from www.clastify.com by James Hronek Rojas
Next, we substitute the values of 𝑥 and 𝑦 from the midpoint and the gradient (𝑚) of the
perpendicular bisector into the equation of a line, 𝑦 = 𝑚𝑥 + 𝑐, to find the y-intercept (𝑐), and
𝑦 = 𝑚𝑥 + 𝑐
79
2.455 = − (1.315) + 𝑐
213
103.885
𝑐 = 2.455 +
r
213
.c
ed
3134
𝑐=
y.
1065
lle
79 3134
va
∴𝑦=− 𝑥+
en
213 1065
ld
𝑦 ≈ −0.371𝑥 + 2.94
go
k@
This procedure is repeated for all additional edges between sites. To make this procedure more
es
m
efficient, I used Microsoft Excel’s equation function to create a spreadsheet that found the
ja
y
midpoints, gradients, and y-intercepts of the other perpendicular bisectors. This is shown in
tif
as
Table 2 below:
Cl
1 𝑥1 + 𝑥2 𝑦1 + 𝑦2
Sites 𝑥1 𝑦1 𝑥2 𝑦2 𝑚 − 𝑐
𝑚 2 2
5
Downloaded from www.clastify.com by James Hronek Rojas
1 𝑥1 + 𝑥2 𝑦1 + 𝑦2
Sites 𝑥1 𝑦1 𝑥2 𝑦2 𝑚 − 𝑐
𝑚 2 2
r
.c
All calculated values in Table 2 above were rounded to 3 significant figures. However, it is
ed
y.
important to note that Excel used the actual values, not the estimates, when calculating the
lle
va
gradients and y-intercepts of the perpendicular bisectors.
en
ld
go
Using the values of the midpoints, gradients, and y-intercepts of the perpendicular bisectors
k@
ne
between the university sites, the Voronoi Diagram was created as seen in figure 2 below.
ro
.h
es
It must be noted that only a section of each perpendicular bisector is included as edges in the
m
ja
Voronoi Diagram. The edges indicate the points that are equidistant between the two sites it
y
tif
bisects, but they stop when the points on the edge become closer to a site different from the
as
Cl
bisected sites.
6
Downloaded from www.clastify.com by James Hronek Rojas
r
.c
ed
y.
lle
va
en
ld
go
k@
ne
ro
.h
es
m
𝑥
ja
y
As explained in the introduction, this investigation aimed to find the university closest to the
Toyota Center. The general rule for Voronoi Diagram is that all the points located inside a cell
are closest to the corresponding site. Hence, to determine which university is closest to the
Toyota Center, we simply have to locate which cell contains the Toyota Center marked at point
𝑇𝐶.
7
Downloaded from www.clastify.com by James Hronek Rojas
According to Figure 2 above, it can be observed that cell D contains the Toyota Center.
However, even though the University of Houston-Downtown is the closest university to the
Toyota Center according to the Voronoi Diagram above, other factors that are not present in
the Voronoi Diagram can dissuade this as the optimal location. These include typical traffic in
the area, hazards (including accidents), blocked roads, speed limits and police traps, and the
r
.c
ed
distance of the routes leading to the Toyota Center. All these factors would reduce the time
y.
lle
taken to arrive at the Toyota Center, so it could potentially make a different university more
va
optimal. Nonetheless, the Voronoi Diagram is a useful starting point for subsequent research
en
ld
In order to further determine which university would be most appealing, I would like to take a
es
m
trip to each university while saving fuel by traveling the minimum possible distance (a real-life
ja
y
application of the traveling salesman problem). The Hamiltonian cycle of least weight would
tif
as
Hamiltonian cycle is “a graph cycle (i.e., closed loop) through a graph that visits each node
exactly once” (Skiena 1991, p. 196).4 The nodes of the graph are represented by the shortlisted
universities, and Rice University would be the starting point for my tour because it is the closest
to my home.
4
Skiena, S., 1991. Implementing discrete mathematics: combinatorics and graph theory with Mathematica.
Addison-Wesley Longman Publishing Co., Inc..
8
Downloaded from www.clastify.com by James Hronek Rojas
Using Waze, I obtained the shortest routes (in km) between each university in order to create a
weighted graph to discover the shortest total distance for this journey. This is illustrated in
Figure 3 below, in which the weight of the edges indicates the distance between the routes and
r
.c
ed
y.
lle
va
en
ld
go
k@
ne
To simplify this, I used the weight of the edges between each vertex to construct a weighted
m
ja
adjacency table.
y
tif
Vertex R S D T H
as
Cl
9
Downloaded from www.clastify.com by James Hronek Rojas
In order to solve a classical TSP, the problem must be converted to a practical TSP. This is
achieved by completing the graph and replacing the direct distance of each pair of vertices with
any attainable shorter distance via an interim point. “A complete graph is a graph in which each
pair of graph vertices is connected by an edge.”5 As indicated in Table 3, all routes are
connected by a single edge to every other vertex therefore Figure 3 is a complete graph.
However, some of the directed routes are longer than a route that goes through an interim point
(for example, the direct distance of vertex R to H is longer than the distance of R to H if we
pass through T first). Hence, Figure 3 shows a graph in the classical TSP form and must be
r
.c
ed
converted to a practical TSP.
y.
lle
va
To convert the graph in Figure 3 to a practical TSP, I have to replace any direct edge with a
en
ld
feasible shorter route via another point to show the least weight path. The graph is not too
go
k@
The updated weighted graph and its corresponding weighted adjacency table are shown below
tif
as
5
Weisstein, E.W. (n.d.). Complete Graph. [online] mathworld.wolfram.com. Available at:
https://mathworld.wolfram.com/CompleteGraph.html#:~:text=A%20complete%20graph%20is%20a
10
Downloaded from www.clastify.com by James Hronek Rojas
r
.c
Figure 4: Updated Weighted Graph
ed
y.
lle
va
Vertex R S D
en T H
ld
Now that the graph is in the form required for the TSP, an approximation for the minimum
weight journey that visits all the vertices can be found. No algorithm has been devised to find
the Hamiltonian cycle of least weight. Instead, an estimation of the minimum weight
To find an upper bound of the minimum Hamiltonian cycle, the nearest neighbor algorithm is
11
Downloaded from www.clastify.com by James Hronek Rojas
The nearest neighbor algorithm is applied to the weighted adjacency table from table 4 in table
r
.c
ed
1 2 5 3 4
y.
lle
Vertex R S D T H
va
en
R 0 2.8 7.1 4.5 7.8
ld
The Hamiltonian cycle formed from the Nearest Neighbor Algorithm can be written as:
Cl
R→S→T→H→D→R
Because all the edges chosen are direct, no additional route has to be added to this cycle.
𝒎 ≤ 𝟐𝟒. 𝟒 𝒌𝒎
12
Downloaded from www.clastify.com by James Hronek Rojas
Now that the upper bound of 𝑚 has been calculated, the deleted vertex algorithm can be used
• Step 1: Delete a vertex, together with all edges connected to it, from the original graph.
• Step 2: Find the minimum spanning tree for the remaining graph.
• Step 3: Add to the length of the minimum spanning tree, the lengths of the two shortest
deleted edges.
Firstly, I chose vertex R to be deleted. Table 6 below shows the weighted adjacency table
r
of table 4 without the vertex R and the edges connected to it.
.c
ed
Vertex S D T H
y.
lle
S 0 4.9 3.5 6.8
va
en
D 4.9 0 6.1 7.7
ld
With Vertex R deleted, the minimum spanning tree of the weighted adjacency table in Table 6
ja
y
above can now be found using Prim’s algorithm. This algorithm can be applied to a weighted
tif
as
• Step 4: Circle the lowest undeleted entry in any of the numbered columns.
The circled entries give the edges of the minimum spanning tree.
13
Downloaded from www.clastify.com by James Hronek Rojas
Prim’s algorithm is applied to the weighted adjacency table from table 6 in table 7 below. The
1 4 2 3
Vertex S D T H
r
H 6.8 7.7 3.3 0
.c
ed
Table 7: Prim’s Algorithm
y.
lle
va
en
Using the weight of the edges circled in red, the weight of the minimum spanning tree =
ld
The shortest edges from the deleted vertex R were RS and RT, with weights of 2.8 𝑘𝑚 and
ro
.h
4.5 𝑘𝑚, respectively. These weights must be added to the weight of the minimum spanning
es
m
tree, 11.7 𝑘𝑚, to complete the deleted vertex algorithm and thus, find the lower bound of 𝑚.
ja
y
𝒎 ≥ 𝟏𝟗 𝒌𝒎
Cl
Deleting a different vertex in the deleted vertex algorithm may produce a different lower bound,
so in order to improve on this lower bound, I repeated the deleted vertex algorithm on other
vertices and replaced the 19 𝑘𝑚 lower bound with the highest found lower bound.
14
Downloaded from www.clastify.com by James Hronek Rojas
Table 8 below shows the weight of the minimum spanning tree of the graph in Figure 4 when
the corresponding vertex is deleted and the total weight of the two shortest edges of the
corresponding deleted vertex, which were added together to find the different lower bounds.
D 9.6 11 20.6
r
T 11 6.8 17.8
.c
ed
H 11.2 10.1 21.3
y.
lle
Table 8: Remaining Lower bounds
va
en
ld
The greater a lower bound is, the more optimal it is. Therefore, according to Table 8 above, the
go
k@
∴ 𝟐𝟏. 𝟑 𝒌𝒎 ≤ 𝒎 ≤ 𝟐𝟒. 𝟒 𝒌𝒎
ro
.h
This range of values gives me an approximation for the minimum length required to visit all
es
m
five universities in the vicinity of the Toyota Center, starting and ending at Rice University at
ja
y
vertex R.
tif
as
Cl
In conclusion, from this investigation, I was able to determine that in terms of location, the
University of Houston-Downtown is the nearest university to the Toyota Center and, thus, the
most optimal choice for a university that would allow frequent visits to the Toyota Center.
However, as previously mentioned, there are other factors that are not present in a Voronoi
Diagram that could potentially dissuade this option from being optimal (e.g., traffic, hazards,
blocked roads, speed limits, and distance of routes). Regardless of all these potential factors,
15
Downloaded from www.clastify.com by James Hronek Rojas
the Voronoi Diagram provides a solid foundation for further investigation using more
Furthermore, this investigation provided me with the range of values of the minimum distance
it would take to visit the five shortlisted universities near the Toyota Center. I realized that
longer routes could save time depending on how busy the area is, and thus I could have created
a graph with the shortest time it takes for the journey rather than the distance. However, for
me, my goal was to save fuel by minimizing distance, so the time it takes for me to visit all five
r
.c
ed
y.
lle
va
en
ld
go
k@
ne
ro
.h
es
m
ja
y
tif
as
Cl
16
Downloaded from www.clastify.com by James Hronek Rojas
Bibliography
https://www.britannica.com/science/coordinate-system.
Skiena, S., 1991. Implementing discrete mathematics: combinatorics and graph theory with
r
Weisstein, E.W. (2021). Voronoi Diagram. [online] mathworld.wolfram.com. Available at:
.c
ed
https://mathworld.wolfram.com/VoronoiDiagram.html.
y.
lle
va
en
ld
go
k@
ne
ro
.h
es
m
ja
y
tif
as
Cl
17