Mathematics in The Modern World-Module 6

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 74

MATHEMATICS

IN THE MODERN
WORLD
The Mathematics of
Graphs
Engr. Michael George A. Baraquel
Course Objectives

➢Graphs and Euler Circuits


➢Weighted Graphs
➢Planarity and Euler’s Formula
➢Graph Coloring
Graphs

➢Think of all various connections we


experience in our lives – friends are connected
on Facebook, cities are connected by roads,
computers are connected across the Internet.
➢A branch of mathematics called graph theory
illustrates and analyzes connections such as
these.
Graphs

➢A graph is a set of points called vertices and


line segments or curves called edges that
connect vertices.
Juan
James Heather

Amy Jared

Lisa
Graphs

➢Graphs can be used to represent may


different scenarios.
TNT DAV
SMB BGSM MLA CEB

NLEX ROS ILO CLK


ALA DUM
Graphs

❑Constructing a Graph: The following table list


five students at a college. An “X” indicates
that the two students participate in the same
study group this semester.
Matt Amber Oscar Laura Kayla
Matt - X X
Amber X - X X
Oscar X - X
Laura X X -
Kayla X -
Graphs
A. Draw a graph that represents this information
where each vertex represents a student, and an
edge connects two vertices if the
corresponding students study together.
B. Use your graph to answer the following
questions: Which student is involved in the
most study groups with the others? Which
student has only one study group in common
with the others? How many study groups does
Laura have in common with the others?
Graphs
Amber

A. Matt Oscar

Kayla Laura

B. The vertex corresponding to Amber is connected to more


edges than the others, so she is involved with more study
groups (three) than the others. Kayla is the only student with
one study group in common, as her vertex is the only one
connected to just on edge. Laura’s vertex is connected to
two edges, so she shares two study groups with the others.
Graphs
➢In general, a graph can include vertices that are
not joined to any edges, but all edges must begin
and end at vertices.
➢If two or more edges connect the same vertex, it
is called a loop.
➢A graph is called connected if any vertex can be
reached from any other vertex by tracing along
edges (Essentially, the graph consists of one
“piece”)
Graphs

➢A connected graph in which every possible


edge is drawn between vertices (without any
multiple edges) is called a complete graph.
Graphs
➢It doesn’t matter whether the edges are drawn
straight or curved, and their lengths are not important.
Nor is the placement of the vertices important. All
matters are which vertices are connected by edges.
A A C B

B
B E
A

D E
C E D
D C
Euler Circuits and Euler Path

❑Konigsberg bridges: Seven bridges crossed


the river and connected four different land
areas
Euler Circuits and Euler Path
❑Euler Circuits: A closed path that uses every edge, but never uses
the same edge twice.
➢The path may cross through vertices more than once.
➢It starts and ends with the same vertex.
➢Euler circuit to exist, the degree of every vertex would have to be
an even number.
❑Euler Path: A path that uses every edge but does not use any
edge more than once.
➢It ends on a different vertex.
❑Eulerian Graph: any graph that has even degree at every vertex
must have a Euler circuit.
Kind of Graphs

❑Eulerian Graph: A graph that contains a


Eulerian circuit.
❑Semi-Eulerian Graph: Contains a Euler path
but not a Euler circuit.
❑Non-Eulerian Graph: A graph that is neither
Eulerian nor Semi-Eulerian.
Kind of Graphs

G1 is has
Eulerian circuit since
there is a trail that
covers all edges at
once and starts and
ends on the same
vertex, thus it is a
Eulerian Graph. Path:
A-B-D-C-E-B-D-E-A-
C-A
Kind of Graphs

G2 is a
semi-eulerian graph
since there is a trail
that will pass to all
edges once that
starts and ends on a
different vertex. Path:
B-A-C-E-B-D-E-A-C-D
Kind of Graphs

G3 on
the other hand, is a
Non-Eulerian graph
since there no
possible way to cover
all edges once
Eulerian Theorem

❑Eulerian Graph Theorem (EGT): A connected


graph is Eulerian if and only if every vertex of the
graph is of even degree.
❑Eulerian Path Theorem (EPT): A connected graph
contains a Euler path if and only if the graph has
two vertices of odd degree with all other vertices
are even. Every Euler path starts at one odd
vertex and end with other vertex of odd degree.
Eulerian Theorem

Example
Which among
a. Vertices of C and D are of odd degree,
the following
by EGT the degree does not have a
has a Eulerian eulerian circuit.
circuit? b. It is observe that all vertices are of
even degree. Since all vertices have an
even degree, by EGT, the graph has a
eulerian circuit.
Eulerian Theorem
Determine if the given graph is
Example Eulerian. If it is, find the Eulerian
circuit. If it is not, explain why.
Answer
∙ The degree of each of the
vertices is 4 (even), hence the
graph is Eulerian.
∙ Circuit: A-D-B-E-C-A-E-D-C-B-A.
Eulerian Theorem
Determine if the given graph is
Eulerian. If it is, find the Eulerian circuit.
Example If it is not, can you find the Euler path?

∙ Using EGT, the graph is not a Eulerian


since two vertices (A and J) had a degree
of 3 which is odd.
∙ Path: A-B-C-D-E-F-G-H-I-J-D-G-A-L-K-J
∙ All edges were used without duplication
and starts with A and ends with J (both
odd degree vertices)
Eulerian Theorem
On the left is the map of the trails in
the National Park. A biker wishes to
traverse all the trails exactly once:
a. Is it possible for the biker to plan a
trip that would cover all the trails exactly
once?
b. Is it possible for him to traverse all the
trail and return from the starting point
without any repeating of trails in the
trip?
Eulerian Theorem
Answer:
a. By trial and error, A-B-E-F-D-B-C-F-G-
C-A-G is a Eulerian path where A and G
are two vertices of odd degree.
b. By EGT, the graph is not Eulerian since
Vertices A and G are of odd degree.
Thus it is not possible for the biker to
traverse all the trail and return from
the starting point without any
repeating of trails in the trip
Hamiltonian Circuits and Path

❑Hamiltonian Circuits: Is a path that begins


and ends at the same vertex and passes
through each vertex of a graph exactly once.
A graph that contains a Hamiltonian circuit is
called Hamiltonian.
Hamiltonian Circuits and Path

❑Hamiltonian Path: A path that visits each


vertex of the graph exactly once that starts
from one vertex and ends to another vertex.
Possible not passing through some of the
edge. Also called as Traceable Path.
Hamiltonian Circuits and Path

❑Unfortunately, unlike Eulerian Graph


Theorem, there is no straightforward criterion
to guarantee that a graph is Hamiltonian, but
we do have the following helpful theorem
which is called the Dirac’s Theorem.
Dirac’s Theorem

❑In a graph with n-vertices, where n>2. if the


degree of each vertex is at least n/2, then the
graph must be Hamiltonian.
Example
Determine whether the
graph on the right side
is a Hamiltonian or
not. If it is, find the
Hamiltonian circuit, If
it is not, explain why?
The graph below shows the available flight of a
popular airlines. An edge between two location
Example indicates a direct flight between two cities. Apply
Dirac’s Theorem to verify that the graph is
Hamiltonian. Find a Hamiltonian circuit.
Cities Direct Flights
Bangkok 6
Ho Chi Min 5
Hong Kong 5
Kuala Lumpur 5
Macau 9
Manila 9
Seoul 5
Singapore 5
Taipei 6
Tokyo 5
Example
Weighted Graph

❑A graph in which each edge is associated


with a value called weight.
CEB
MLA CLK
1858
713

1483
1745 748
2145
803

ILO DUM

DAV
Weighted Graph

❑The table below lists the distances in miles


between six popular cities that a particular
airline fly to. Suppose a traveler would like to
start in Chicago. Find three different routes
that the traveler could follow, and find the
total distance flown for each route.
Weighted Graph
Chicago New York Washington DC Philadelphia Atlanta Dallas
Chicago - 713 597 665 585 803
New York 713 - No flights No flights 748 1374
Washington DC 597 No flights - No flights 544 1185
Philadelphia 665 No flights No flights - 670 1299
Altanta 585 748 544 670 - No flights
Dallas 803 1374 1185 1299 No flights -

➢The various options will be simpler to


analyze if we first organize the information in
a graph.
Weighted Graph
New York

713
Chicago 597 Washington
748

554
803

1374
665

Dallas 1299 Philadelphia


585
670

Atlanta
Weighted Graph
New York
➢1st Route:
713 Washington
Chicago ➢Chicago → New York
597
748 → Dallas →
554
Philadelphia → Atlanta
803 → Washington →
1374
Chicago.
665 ➢713 + 1374 + 1299
Philadelphia
Dallas 1299 + 670 + 544 + 597 =
585
670
5197

Atlanta
Weighted Graph
New York
➢2nd Route:
713 Washington
Chicago ➢Chicago →
597
748 Philadelphia → Dallas
554
→ Washington →
803 Atlanta → New York
1374
→ Chicago.
665 ➢655 + 1299 + 1185
Philadelphia
Dallas 1299 + 544 + 748 + 713 =
585
670
5154

Atlanta
Weighted Graph
New York
➢3rd Route:
713 Washington
Chicago ➢Chicago →
597
748 Washington → Dallas
554
→ New York →
803 Atlanta → Philadelphia
→ Chicago.
1374
665 ➢597 + 1185 + 1374
Philadelphia
Dallas 1299 + 748 + 670 + 655 =
585
670 5239

Atlanta
Algorithms in Complete Graphs

❑A step by step method to calculate the


smallest total weight possible to find a pretty
good solution.
❑Does not guarantee to have the lowest
possible weight.
❑Greedy and Edge Picking Algorithm
The Greedy Algorithm

➢It is called the greedy algorithm because at


any opportunity we get, it asks us to choose
the cheapest / smallest weight alternative.
➢Attempts to offer a minimum total weight
circuit.
The Greedy Algorithm
➢Steps:
1. Choose a vertex to start it, then travel along the
connected edge that has the smallest weight. (If
two or more edges have the same weight, pick any
one.)
2. After arriving at the next vertex, travel along the
edge of the smallest weight that connects to a
vertex not yet visited. Continue this process until
you have visited all vertices.
3. Return to the starting vertex.
The Greedy Algorithm

➢Using the greedy algorithm to find a Hamiltonian


circuit in the weighted graph. Start a vertex A.
A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
2
E C
8 12

D
The Greedy Algorithm
➢Hamiltonian Circuit is A-D-B-F-E-C-A.
➢Start a vertex A. ➢Weight of circuit is
4+2+5+10+6+15=42
A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
E 2 C
8 12

D
Edge Picking Algorithm
➢Steps:
1. Mark the edge of smallest weight in the graph. (If
two or more edges have the same weight, pick any
one.)
2. Mark the edge of next smallest weight in the graph,
as long as it does not complete a circuit and does
not add a third marked edge to a single vertex.
3. Continue this process until you can no longer mark
any edges. Then mark the final edge that completes
the Hamiltonian circuit.
Edge Picking Algorithm

➢Using edge picking algorithm to find a Hamiltonian


circuit in the weighted graph.
A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
2
E C
8 12

D
Edge Picking Algorithm

➢First, highlight the edge of the smallest weight.


A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
2
E C
8 12

D
Edge Picking Algorithm

➢Then highlight the edge of the second smallest


weight.
A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
2
E C
8 12

D
Edge Picking Algorithm

➢The next smallest weight is 5 which appears twice,


with edge AE and FB, we can pick mark the two.
A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
2
E C
8 12

D
Edge Picking Algorithm
➢There are two edges that weighs 6, BC and EC. We cannot
pick BC since it would add a third mark edge on vertex B,
hence we will only mark EC.
A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
2
E C
8 12

D
Edge Picking Algorithm
➢We are at Step 3 of the algorithm, any edge we mark will either complete
the graph or add a third edge to a vertex.
➢So we marked the final edge to complete the Hamiltonian circuit, edge FC
A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
2
E C
8 12

D
Edge Picking Algorithm
➢Beginning at vertex A, the Hamiltonian circuit is A-D-B-F-C-E-A (in
reverse direction, A-E-C-F-B-D-A)
➢Total Weight: 4 + 2 + 5 + 14 + 6 + 5 = 36
A
13
15 8

F 5 B
7 14 4 11
10 6
5
6
2
E C
8 12

D
Planarity
➢A puzzle that was posed some time ago goes like
this:

➢Can they run a pipe without crossing over each


other’s pipes at any point?
Planar Graph

➢It is a graph that can be drawn so that no edges


intersect each other (except at vertices).
➢If the graph is redrawn in such a way that no
edges overlap, it is called planar drawing.
Planar Graph

➢Show that the graph below is planar.


Subgraph Theorem
➢One strategy we can use to show that a graph is not planar
is to find a subgraph.
➢If a graph G has a subgraph that is not planar, then G is also
not planar. In particular, if G contains the Utilities Graph or K5
as a subgraph, G is not planar.

➢K5 a complete graph with 5 vertices


Utility Graph
➢Is a graph composed for two sets of vertices, U and V, such
that each vertices of U are connected to each vertices of V.
Nonplanar Graph Theorem

➢A graph is nonplanar if and only if has a


utilities graph of K5 as a subgroup, or at least
a subgraph than can be contracted to the
utilities graph of K5
Nonplanar Graph Theorem

➢Show that following graph is not planar


Nonplanar Graph Theorem

➢The subgraph form a utility


graph, therefore the original
graph is not planar
Nonplanar Graph Theorem

➢We can expand the strategy by considering


contractions of subgraph. A contraction of
graph is formed by shrinking and edge until
the two vertices it connects come together
and blend into one. If, in the process, the
graph is left with any multiple edges, we
merge them into one.
Nonplanar Graph Theorem

Shrink the Until it Combine the


Bottom edge vanishes multiple
edges to one

➢Example of contraction technique


Nonplanar Graph Theorem

➢Show that following graph is not planar using contraction


technique.

We were able to contract our graph to


K5, so by the nonplanar graph theorem,
the given graph is not planar
Euler’s Formula

➢Euler noticed a connection between various


features of planar graphs. In addition to edges
and vertices, he looked at faces of a graph.
➢In planar drawing of a graph, the edges divide
the graph into different regions called faces.
➢The region surrounding the graph, or the exterior
is also called the infinite face.
Euler’s Formula

➢In a connected planar graph drawn with no


intersecting edges, let v be the number of
vertices, e the number of edges, and f the number
of faces.
➢Then v + f = e + 2
Euler’s Formula

➢Count the number of edges, vertices, and


faces in the planar graph below, and then
verify Euler’s formula.
There are seven edges, five vertices, and four
faces (counting the infinite face)
Thus v + f = 5+4=9 and e + 2 = 7+2=9
So, v + f = e + 2, as Euler’s Formula predicts
Graph Coloring

➢Technique of assigning of colors to each


vertex of a graph G so that no adjacent
vertices get same color.
➢Started in the mid-1800’s when Francis
Guthrie tried to color the map of England so
that it would be easy to discern the countries
sharing the common boundary.
Vertex Coloring

➢A vertex coloring is an assignment of labels or


colors to each vertex of a graph in such a way that
two identically colored vertices are connected by
any edge.
Edge Coloring

➢Edge coloring of a graph is an edge coloring such


that no two neighboring edges are given the same
color.
The Chromatic Number of Graph

➢The smallest number of colors needed to color a


graph.
➢2-Colorable Graph Theorem: A graph is 2-colorable
if and only of it has a circuit that consist of an odd
number of vertices.
➢Four Color Theorem: The chromatic number of a
planar graph is at most 4.
Graph Coloring Application

➢Eight different schools clubs want to schedule


meetings on the last day of the semester. Some
club members, however, belong to more than one
of these clubs, so clubs that share members cannot
meet at the same time. How many different time
slots are required so that all members can attend
all meetings? Clubs that have a member in
common are indicated with an “X” in the table
below.
Graph Coloring Application
Student Debate Honor Student Community Campus Campus
Ski Club
Government Club Society Newspaper Outreach Democrats Republicans
Ski Club - X X X X
Student
X - X X X
Government
Debate Club X - X X X
Honor
X X X - X X
Society
Student
X X - X X
Newspaper
Community
X X X - X X
Outreach
Campus
X X X -
Democrats
Campus
X X X -
Republicans

➢We can represent the given information by a graph.


➢Each club represent by a vertex, and an edge connect two
vertices if the corresponding clubs have at least one common
member
Graph Coloring Application
SC SC

CR SG SG
CR

CD DC CD DC

CO HS HS
CO

SN SN
➢ First time slot: Ski Club, Debate Club, Student Newspaper.
➢ Second time slot: Student Government, Community Outreach
➢ Third time slot: Honor Society, Campus Democrats, Campus Republicans
Thank You!!!

You might also like