Module7 Graph Theory
Module7 Graph Theory
MODULE
Mathematics of Graphs
Overview
Welcome to Graph Theory!
In this module, we will discuss the basic terms in graph theory as an introductory
course for students. It will include how to use graph theory in solving problems like
the TSP and other route problems.
Learning Outcomes
By the end of the module, students will be able to:
References:
[1] Baltazar, E.C, Evangelista, J, & Ragasa, C. (2018). Mathematics in the
Modern World. C&E Publishing
[2] Sobecki, D. (2019). Math in our World. (4th Ed.). McGraw-Hill Education
[3] Leonhard Euler | Biography, Education, Contributions, & Facts | Britannica
[4] Euler Graph | Euler Path | Euler Circuit | Gate Vidyalay
[5] Putting It Together: Graph Theory | Mathematics for the Liberal Arts
[6] Euler’s Map Theorem: a Surprising Activity – Occupy Math
[7] https://www.britannica.com/biography/William-Rowan-Hamilton
[8] Examples of Traveling Salesman Problems
MATHEMATICS IN THE MODERN WORLD
MODULE
[1] https://www.britannica.com/biography/Leonhard-Euler
MATHEMATICS IN THE MODERN WORLD
MODULE
Terms to Remember:
A graph consists of a finite set of points called vertices and line segments or
curves called edges connecting the points.
If every pair of vertices of a graph are adjacent, the graph is complete. A complete
graph with n vertices is denoted by Kn.
These are most of the definitions that we need to remember when dealing
with graph theory. One is expected to be familiar with the terms so that one can
follow the discussion being presented.
Now that we know that the graph is not the usual graph that presents
statistical data. Instead it represents relationships between people, places, even
things and other matters. We start the discussion on how to represent any
relationship as a graph.
MATHEMATICS IN THE MODERN WORLD
MODULE
Rene --- X X X
Madz X --- X X
Allan X X --- X
Norma X ---
Kiko X X ---
We represent each student as the vertex, and the edge between them
represents the fact that they study together and come up with this graph.
MATHEMATICS IN THE MODERN WORLD
MODULE
The map shown in the figure shows five counties in central Pennsylvania.
Draw a graph that shows the counties that share a common border.
The county is the vertex and the border as the edge.
Graph Coloring
One of the uses of graph theory is in coloring maps as shown in a previous
example.
A coloring for a graph is a method of coloring all the vertices so that any pair
of vertices joined by an edge have different colors.
The smallest number of colors that can be used for coloring a graph is called
its chromatic number.
MATHEMATICS IN THE MODERN WORLD
MODULE
Graph coloring started in the mid-1800’s when Francis Guthrie tried to color
the map of England to easily distinguish countries with the same border by making
sure that countries with the same border have different colors.
Several attempts later, he found out that a maximum of four colors is needed
to color a map.
We have a theorem for this one:
Four-Color Theorem
The chromatic number of a planar graph is at most 4.
A planar graph is a graph that can be drawn so that no edges intersect each
other (except at vertices).
Graph coloring is used
mostly in scheduling, so a
person attending several
meetings will not meet a conflict
of time.
Airlines also use this, to
avoid conflict of air space for
planes using the same terminal.
Represent this as a graph with the committee as vertices and members as edges.
Then color with a minimal number.
In this case, the chromatic number is 3.
MATHEMATICS IN THE MODERN WORLD
MODULE
Use graph coloring to find the number of different colors that would be necessary
to color the map at the right so that no states with a common border are the same color.
Then color the map using what you learned from your graph.
Then we color the graph, with no adjacent vertices having the same color.
And use that idea to color the map.
The chromatic number for this is 4.
MATHEMATICS IN THE MODERN WORLD
MODULE
The quiz is not timed, so you can pause it and resume at any time.
If you cancel the quiz, your answers are discarded and they are not counted as a submission.
Eulerian Graphs
The Euler Circuit is named after Leonhard Euler[1].
This graph is his response to the question “Is it possible to cross all bridges
of Konigsberg exactly once?”.
He came up with a graph, represented by vertices for each town of
Konigsberg and an edge for the seven bridges and tried to find a path that would
allow him to use each exactly once.
The answer was NO, and he had a theorem to prove it. Before discussing
the theorem, let’s have some definitions that are also important in the study of
Euler paths and circuits.
A path is an alternating sequence of vertices and edges. It can be
seen as a trip from one vertex to another using the edges of the graph.
If a path begins and ends with the same vertex, it is a closed path or a
circuit/cycle.
[1] Leonhard Euler | Biography, Education, Contributions, & Facts |
Britannica
MATHEMATICS IN THE MODERN WORLD
MODULE
Example:
Can you trace a path here that uses each of the edges exactly once? Is it a
path or a circuit?
An Euler path is a path that passes through each edge exactly once.
A circuit that uses every edge, but never uses the same edge twice, is called
an Euler circuit.
With these new definitions, was the path or circuit Eulerian?
Using the graphs below, can you identify which is a path or circuit?
During the establishment of Google Maps, aside from satellite views, there were
also street views that were put up. We don’t want to think that the Google people in
charge of those worked with Asia first, then jump to the US, and back again to Asia
because they forgot a nation. We like to think that they have done methodically, street
by street.
But if one is working on their own, how do we know that we are on the right track,
or in this case path, of doing a correct Eulerian graph. For that, we need the Euler Path
Theorem.
Was it easier to identify which one is the Euler Path? Or the Euler Circuit?
Hopefully, your answer is YES.
MATHEMATICS IN THE MODERN WORLD
MODULE
Fleury’s Algorithm
Another way to find an Eulerian graph is through a process known as the Fleury’s
Algorithm.
Fleury’s Algorithm
To find an Euler path or Euler circuit:
1. If a graph has no odd vertices, start at any vertex. If the graph has
two odd vertices, start at either odd vertex.
2. Number the edges as you trace through the graph making sure not to
traverse any edge twice.
3. At any vertex where you have a choice of edges, choose one that is
not a bridge for the part of the graph that has not yet been numbered.
Example: A mail carrier has the neighborhood pictured in the figure on his route. He
wants to cover each street
exactly once without retracing
any street. Find an Euler path to
accomplish this.
The quiz is not timed, so you can pause it and resume at any time.
If you cancel the quiz, your answers are discarded and they are not counted as a submission.
MATHEMATICS IN THE MODERN WORLD
MODULE
Hamiltonian Graphs
The Hamiltonian Graph is named after William Rowan Hamilton[1].
A Hamilton Graph is usually used in problems involving Shortest Path
Algorithms.
How fast can we visit all places in one go is typically the question asked.
Problems like the Travelling Salesman problem, is one of the most famous
problems dealt with in Hamiltonian Graphs.
Before discussing the different methods in finding a Hamiltonian Graph, let’s
have some definition.
A Hamiltonian path is a path that visits each vertex of the graph exactly once.
A Hamiltonian circuit is a path that uses each vertex of a graph exactly once
and returns to the starting vertex.
[1] Sir William Rowan Hamilton | Irish Mathematician, Astronomer & Physicist |
Britannica
A Complete Graph
Please keep in mind always that unlike the Euler Theorem that guarantees the
existence of an Eulerian graph, Hamilton graphs have no such method.
Though, there is a condition that guarantees the existence of a Hamiltonian
circuit.
That is if a graph is complete.
In case, you need a reminder: A complete graph[1] is a graph that has an edge
connecting every pair of vertices.
Since we now have an assurance that there is a Hamiltonian circuit, how many
circuits are there?
The graph shows the distances in miles between four cities that a saleswoman
needs to visit in one day.
Let A = Adamsburg, I= Irwin, P=Penn, and T=Trafford
The shortest route found in this graph is called the optimal solution.
The optimal solution for a traveling salesperson problem is a Hamilton circuit for
a complete weighted graph for which the sum of the weights of the edges traversed is
the smallest possible number.
In solving TSPs, it is always assumed that we are dealing with Hamiltonian
circuits, we assume two things, 1) they are complete graphs, and 2) they are weighted
or have values assigned to them.
Let’s start the discussion on the three methods, and how the process of finding
the optimal solution differs in the following sections.
So either Circuit 2 (AITPA) or 4 (APTIA) is the shortest path, both with 51 miles.
Hence, the optimal solution.
NOTE: If there is a tie on the smallest weight from the same vertex, pick either
or any of the tie/s.
Example: Aaron, Belle, Carol, Donna, Eric, and Fe are best of friends.
The figure below shows the distances (km) from a friend’s place to another.
If Aaron wants to visit each of his friends’ houses exactly once to drop off gifts,
what is the shortest route that he must take?
MATHEMATICS IN THE MODERN WORLD
MODULE
So Aaron has to travel 33 miles to drop off all his gifts, and this is the shortest
path he can take.
This is the graph of the circuit taken if one is starting from Aaron’s.
A new circuit may be formed if a different friend is off dropping gifts.
MATHEMATICS IN THE MODERN WORLD
MODULE
NOTE: If there is a tie on the weights of edges, pick either or any of the tie/s.
Using this graph and employing the cheapest link method, we find the optimal
solution to travel through the following towns.
MATHEMATICS IN THE MODERN WORLD
MODULE
For further practices, use the 3 different problems and solve them on your own
using the different methods and compare the optimal solution for each.
Brochure Blues
Instructions