0% found this document useful (0 votes)
222 views95 pages

Mathematics in The Modern World Module 6

[GRAPH] This graph is not Eulerian. While most vertices have even degree, vertex B has odd degree of 3. For a graph to have an Euler circuit, the degree of every vertex must be even. Since vertex B has odd degree, there cannot be an Euler circuit that uses every edge exactly once and returns to the starting point without repeating any edges.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
222 views95 pages

Mathematics in The Modern World Module 6

[GRAPH] This graph is not Eulerian. While most vertices have even degree, vertex B has odd degree of 3. For a graph to have an Euler circuit, the degree of every vertex must be even. Since vertex B has odd degree, there cannot be an Euler circuit that uses every edge exactly once and returns to the starting point without repeating any edges.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 95

1.

Let x = amount invested in bonds at 2% (1pt)


10,00 - x = amount invested in stocks at 6% (1pt)

0.02x + [(10,000 - x) 0.06] = 420 (2pts solution)


0.02x + 600 - 0.06x = 420
-0.04x + 600 = 420
10,000 - x (1pt solution)
-0.04x = 420 - 600
10,000 – 4,500
-0.04x = -180 = 5,500 (amount invested in bonds) (1pt)
-0.04 -0.04
x = 4,500 (amount invested in bonds) (1pt)
2. (0.85 per share) x (650 shares) = 552.50 (1pt)
(1pt solution)
3. Let x = amount invested at 5% bonds (1pt)
18,000 - x = amount invested at 12% bonds (1pt)

5% profit + 885 = 12% profit (2pts solution)


0.05x + 885 = 0.12 ( 18,000 – x )
0.05x + 885 = 2,160 – 0.12x
0.05x + 0.12x = 2,160 - 885
0.17x = 1,275
0.17 0.17
x = 7,500 (amount invested in bonds at 5%) (1pt)
THE MATHEMATICS
OF GRAPHS
Introduction
• Graph theory is a branch of Mathematics that was developed
after Leonhard Euler (1707 1783), a Swiss mathematician,
solved an eighteen – century problem involving the seven
bridges of Konigsberg in Old Prussia.
• The city of Konigsberg (now Kaliningrad, Russia) has four
districts divided by the Pregel River.
• Seven bridges connected these districts.
Introduction
Introduction
• In Euler’s time, people were puzzled if there is a travel route
that would only cross each of the seven bridges exactly one.
• Euler proved in 1736 that it is impossible to take a stroll that
would lead them across each bridge and return to the
starting point without traversing the same bridge twice.
• Problems involving connections such as the seven bridges of
Konigsberg is the subject matter of this chapter.
Introduction
• At present, graph theory finds many applications in the social
sciences (social network sites), computer science (networks
of communication), chemistry (chemical structure).
• Communication arts (networks of communication), and
operations research (network analysis).
Learning Objectives
At the end of this chapter, the student is expected to:
• differentiate Eulerian from Hamiltonian graphs;
• apply Euler and Hamiltonian paths to solve problems; and
• solve problems using graphs.
Topics
• Topic 1: Graph
• Topic 2: Euler Paths and Circuits
• Topic 3: Hamiltonian Paths and Circuits
• Topic 4: Graph Coloring
• Topic 5: Tree
Topic 1: Graph
• A graph is a collection of points called vertices or nodes and
line segment or curves called edges that connect the
vertices.
• The position of the vertices, the lengths of the edges, and
the shape of the edges do not matter in a graph.
• Sometimes the edges are given orientations and are
presented by arrows or are given values (weights).
• But it is the number of vertices and which of them are joined
by edges that matter most.
Topic 1: Graph
• Graphs can be used to illustrate huge connections such as
social networks in Facebook, flight destinations of airlines,
the simple community garbage collection route, or even the
computer system connectivity in a school.
Example: Constructing a Graph
• The following table lists eleven cities connected by Cebu
Pacific airline flights.
• The symbol (/) indicates that the cities have direct flights.
Example: Constructing a Graph
Example: Constructing a Graph
• Draw a graph that presents this information where each
vertex represents a city and an edge connects two vertices if
the two cities have a direct flight.
• Use your graph to determine which city has the most and
least number of direct flights.
Solution:
a. Draw eleven vertices (in any configuration you wish) to
represent the eleven cities, and connect the vertices with
edges according to the table.
Solution:
b. The Manila vertex has nine edges attached to it; hence,
Manila has the most number of direct flights.
On the other hand, the Macau vertex is connected to
only one node; hence, Macau has the least number of direct
flights.
It is important to note also that the vertex of Brunei is
not connected to any node; hence, Brunei does not have a
direct flight to any of the ten cities.
Some Definitions
• A loop is the edge connecting a vertex to itself.
• If two vertices are connected by more than one edge, these
edges are called multiple edges.
• A graph with no loops and no multiple edges is called a
simple graph.
• A path is an altering sequence of vertices and edges. It can
be seen as a trip from one vertex to another using the edges
of the graph.
Some Definitions
• A graph is connected if there is a path connecting all the
vertices.
• If a path begins and ends with the same vertex, it is called a
closed path or a circuit or cycle.
• Two vertices are adjacent if there is an edge joining them.
• If every pair of vertices of graph are adjacent, the graph is
complete. A complete graph with n vertices is denoted by
Kn.
• The degree of a vertex is the number of edges attached to it.
Examples of Graph: Null or Disconnected
Graph.
• The graph below is a null or disconnected graph since it has
four vertices but no edges.
• The degree of each vertex is 0.
Examples of Graph: Graph with a Loop.
• The loop connects vertex A to itself.
• The degree of a loop is 2.
Examples of Graph: Graph with Multiple
Edges.
• Both graphs G1 and G2 on the next page are connected and
have multiple edges connecting vertices A and B.
• The degrees of vertices of A and B in G1 are both equal to 3
while that of G2 are both equal to 4.
Examples of Graph: Complete Graph.
• A complete graph is a connected graph in which every edge
is drawn between vertices.
Examples of Graph: Complete Graph.
Examples of Graph: Complete Graph.
Let e be the number of edges in a complete graph.
From e the results above, we find that for:
• K1: e = 0, degree of the vertex is 0.
• K2: e = 1, degree of the vertex is 1.
• K3: e = 3, degree of the vertex is 2.
• K4: e = 6, degree of the vertex is 3.
• K5: e = 10, degree of the vertex is 4.
• What about Kn, a complete graph with n vertices?
• How many edges could we possibly get and what is
the degree of each vertex in the graph?
• The number of edges is equal to:

• for n ≥ 3 while the degree of each vertex is


obviously equal to n – 1.
Activity 1
Activity 1
Activity 1
Topic 2: Euler Paths and Circuits
Euler Circuits
• An Euler circuit is a closed path that uses every edge, but
never uses the same edge twice.
• The path may cross through vertices more than once.
• In the Konigsberg bridges problem, finding a path crosses
each bridge exactly once and returning to the starting point
is the same as finding an Euler circuit in the graph below.
• Euler proved that the graph does not have an Euler circuit
because for an Euler circuit to exist, the degree of each
vertex in the graph must be even.
• Apparently, all the vertices in the Konigsberg bridges
problem have odd degrees; hence not Eulerian.
Eulerian Graph Theorem
• A connected graph is Eulerian if and only if every vertex of
the graph is of even degree.

• Note that the Eulerian Graph Theorem only guarantees that


if the degrees of all the vertices in a graph are even, an Euler
circuit exists, but it does not tell us how to find one.
Example 1:
• Determine whether the following graph is Eulerian. If it is,
find an Eulerian circuit. If it is not, explain why.
Solution:
• The degree of each of the vertices is 4
(even); hence, the graph is Eulerian.
• The path A – D – B – E – C – A – E – D –
C – B – A starts at vertex A and ends at
vertex A; hence it is circuit.
• Moreover, it uses all the edges all the
edges only once; hence it is an Euler
circuit.
Euler Path
• An Euler path is a path that uses every edge in the graph
exactly once but it does not start and end at the same
vertex.
Example 2:
• Determine whether the following
graph is Eulerian. If it is, find a
Eulerian circuit.
• If it is not, can you find an Euler
path?
Solution:
• Using the Eulerian Graph Theorem,
this graph is not Eulerian since
vertices A and J both have odd
degrees.
• But the path A – B – C – D – E – F – G –
H – I – J – D – G – A – L – K – J uses
every edge without duplication, hence
the graph contains an Euler path.
• Furthermore, it can be noted that the
path starts at A but ends at J, the
vertices having odd degrees.
Euler Path Theorem
• A connected graph contains an Euler path if and only if the
graph has two vertices of odd degrees with all other vertices
of even degrees.
• Furthermore, very Euler path must start at one of the
vertices of odd degrees and end at the other.
Example 3: An Appointment of Euler Path
Theorem
• Below is the map of all the trails in a national park. A biker
would like to traverse all the trails exactly once.
a. Is it possible for the biker to plan a trip that traverses all
the trails exactly once?
b. Is it possible for him to traverse all the trails and return to
the starting point without repeating any trail in the trip?
Solution:
a. By the Euler Path Theorem, the map shows an Euler path
since the graph has two vertices of odd degree with all
other vertices of even degree.
By trial and error, the path A – B – E – F – D – B – C – F –
G – C – A – G uses every edge without duplication, hence an
Euler path.
Thus, it is possible for the biker to plan a trip that
traverses all the trails exactly once.
The trip starts at point A, a vertex with an odd degree
and ends at point G, the other vertex with an odd degree.
Solution:
b. Using the Eulerian Graph Theorem, this graph is not
Eulerian since vertices A and G both have odd degrees.
Thus, it is not possible for the biker to traverse all the
trails and return to the starting point without repeating any
trail in the trip.
Activity 2
Direction: 1. Determine whether the graph is Eulerian. If it is, find an
Eulerian circuit. If it is not, explain why? If the graph does not have
an Euler circuit, does it have an Euler path? If so, find one If not,
explain why.
Activity 2
2. For each of the networks below, determine whether it has an
Euler path. If it does, find one.
Topic 3: Hamiltonian Paths and Circuits
• Sir William Rowan Hamilton
Topic 3: Hamiltonian Paths and Circuits
• Hamiltonian
• 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.
• A graph that contains a Hamiltonian circuit is called
Hamiltonian.
Topic 3: Hamiltonian Paths and Circuits
• In Euler circuits, closed paths use every edge exactly once,
possibly visiting a vertex more than once.
• On the contrary, in Hamiltonian circuits, paths visit each
vertex exactly once, possibly not passing through some of
the edges.
• But unlike the Euler circuit, where the Eulerian Graph
Theorem is used to determine whether it contains an Euler
circuit or not, there is no straightforward criterion to
determine whether or not a Hamiltonian circuit exists in a
graph.
Dirac’s Theorem
• Consider a connected graph with at least three vertices and
no multiple edges.
• Let n be the number of vertices in the graph.
• If every vertex has degree of at least 𝑛/2, then the graph
must be Hamiltonian.
Example 1:
• Determine whether the graph below is Hamiltonian or not.
• If it is, find a Hamiltonian circuit.
• If it is not, explain why.
Solution:
• There are seven vertices, hence 𝑛/2 = 3.5. Since vertex A is a
degree 2, less than 3.5, Dirac’s Theorem does not apply here.
• But it does not necessarily follow that the graph is not
Hamiltonian.
• In fact, it is. Consider the path A – B – C – E – D – F – G – A.
• This path visits each vertex only once in the graph and
returns to its starting point, therefore, it is Hamiltonian
Example 2: An Application of Hamiltonian
Circuits
• The graph below shows the available flights of a popular
airline.
• An edge between two vertices indicates that there is a direct
flight between the two cities.
• Apply Dirac’s Theorem to verify that the graph is
Hamiltonian.
• Then find a Hamiltonian circuit.
Example 2: An Application of Hamiltonian
Circuits
Solution:
• There are ten vertices in the graph, so n = 10 and 𝑛/2 = 5.
• Now, vertex Manila has nine edges, Tokyo has five, Seoul has six,
Teipei has six, Hong Kong has seven, Macau has nine, Bangkok has six,
Ho Chi Minh has five, Kuala Lumpur has five, and Singapore has five.
• Using Dirac’s Theorem, if each vertex has a degree of at least 𝑛/2 = 5,
then the graph is Hamiltonian.
• This means that the graph contains a circuit that visits each vertex and
returns to its starting point without visiting a vertex more than once.
• By trial and error, one Hamiltonian circuit is Manila – Tokyo – Seoul –
Hong Kong – Macau – Bangkok – Ho Chi Minh – Kuala Lumpur –
Singapore – Manila.
Solution:
• In example 2, there is a number of different paths which are
Hamiltonian.
• For example, Manila – Tokyo – Seoul – Hong Kong – Macau –
Bangkok – Ho Chi Minh – Kuala Lumpur – Singapore – Taipei –
Manila is another Hamiltonian circuit that represents a sequence
of flights that visits each city and returns to the starting city
without visiting any city twice.
Solution:
• Although generally the lengths of the edges do not mmatter in
the graph, there is now concern over the route that minimizes the
distance travelled.
• In other words, there is a need to know which of these
Hamiltonian routes is the cheapest.
• Hence, it is but important that one focuses on the distances
between cities.
• These distances can be presented using weighted graphs.
Weighted Graphs
• A weighted graph is a graph in which each edge is associated with
a value, called weight.
Example 3: An Application of Hamiltonian
Circuits
• The table below lists down the distance (miles) between the cities
having direct routes as well as the corresponding distances
between them.
Example 3: An Application of Hamiltonian
Circuits
a) Draw a graph that represents this information where each
vertex represents a city and an edge connects two vertices if the
two cities have a direct flight with their corresponding weights.
b) Find two different routes that visit each of the places and return
to its starting point without visiting any city twice. Compare the
total number of miles travelled by each of these routes.
Solution:
Manila Cebu
Solution:
a) The graph along with the weights of the edges is shown on the
next page.
b) One Hamiltonian circuit is Ozamis – Cagayan de Oro – Cebu –
Palawan –Manila – Davao – Ozamis. The total distance travelled
is 64 + 137 + 354 + 358 + 589 + 133 = 1,635 miles. Another node
route is Ozamis – Davao – Cagayan de Oro – Palawan – Cebu –
Manila – Ozamis. This circuit has a total distance of 133 + 118 +
414 + 354 + 355 + 477 = 1,851 miles. Obviously, the first node
route is shorter than the second.
• In Example 3, we computed two Hamiltonian routes. But these
results do not guarantee that one of them is the shortest distance
travelled. From the solution in Example 3, is Ozamis – Cagayan de
Oro – Cebu – Palawan –Manila – Davao – Ozamis the shortest
route?
• There is no guarantee. If this is the case, how can the shortest
route be determined after visiting all the cities exactly once and
going back to the origin city?
• One method is to down all the Hamiltonian circuits, compute the
total weight, and choose the smallest total weight. Unfortunately,
this is tedious especially when the number of possible circuits is
too large.
• However, there are two algorithms, the greedy algorithm and the
edge-picking algorithm, that can help in finding a good solution.
The Greedy Algorithm
1. Choose a vertex to start at, and 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 an 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.

Note that both of these algorithms apply only to complete graphs.


Example 4:
Aaron, Belle, Carol, Donna, Eric,
and Fe are best of friends. The
figure below shows the
distances (in kilometers) from a
friend’s place to another. If
Aaron wants to visit each of his
friend’s houses exactly once,
what is the shortest route that
he must take?
Solution: Using the Greedy Algorithm
• To find the least route that Aaron can take, one can find a Hamiltonian
circuit using the greedy algorithm.
• By trial and error, one Hamilton circuit is from Aaron’s house – Belle’s
house – Carol’s house – Donna’s house – Eric’s house – Fe’s house –
Aaron’s house. The total weight of the circuit is 1 + 2 + 3 + 9 + 6 + 12 =
33. But there are other Hamiltonian circuit from Aaron’s house.
• Consider the Hamiltonian circuit from Aaron’s house – Eric’s house –
Fe’s house – Carol’s house – Donna’s house – Belle’s house and back to
Aaron’s house. The total weight of this circuit is 5 + 6 + 7 + 3 + 10 + 1 =
32.
• Ironically, this circuit has a weight lesser than the weight of the circuit
derived using the greedy algorithm.
• Thus, the greedy algorithm only attempts to give a circuit of minimal
total weight, although it does not always succeed.
The Edge-Picking Algorithm
1. Mark the edge of the smallest weight in the graph. (If two or
more edges have the same weight, pick any one.)
2. Mark the edge of the 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.
Aaron Carol

Belle Donna
Solution: Using the Edge-Picking Algorithm
• To find the route with the least distance that Aaron can take, one
can find a Hamiltonian circuit using the edge-picking algorithm.
• First, mark the line segment from Aaron’s house to Belle’s house,
of weight 1.
• Next, mark the segment from Belle’s to Carol’s house, of weight 2,
followed by Carol’s to Donna’s house, of weight 3, followed by
Eric’s to Fe’s house, of weight 6.
• Take note that we cannot mark the segment from Eric’s house to
Aaron’s house because it can complete a circuit.
Solution: Using the Edge-Picking Algorithm
• Also, we cannot mark the segment from Carol’s to Fe’s house because
it can make the third marked edge on a vertex.
• Finally, to complete the circuit, we mark the line segment from Fe’s
house back to Aaron’s.
• The final Hamiltonian circuit, of the total weight 1 + 2 + 3 + 6 + 9 + 12
= 33, is Aaron’s house – Belle’s house – Carol’s house – Donna’s house
–Eric’s house – Fe’s house and back to Aaron’s house.
• A Hamiltonian circuit forms a complete loop so we can actually start
from any of the vertices.
• It is important to note that we can reverse the direction in which we
follow the circuit.
Topic 4: Graph Coloring
• Graph coloring started in the mid-1800’s when Francis Guthrie
tried to color the map of England so that it would be easy to
distinguish the countries sharing a common border.
• He made sure that countries with the same border must have
different colors.
• After many attempts, he found out that a maximum of four colors
we required to color the map.
Graph Coloring
• In graph coloring, each vertex of a graph will be assigned one
color in such a way that no two adjacent vertices have the same
color.
• The interesting idea here is to determine the minimum number of
distinct colors to be used so that each vertex of a graph is colored
such that no two adjacent vertices have the same color.
• A practical application of the graph coloring problem is in
scheduling meetings or events.
Planar Graph
• A planar graph is a graph that can be drawn so that no edges
intersect each other (except at vertices)
The Chromatic Number of a Graph
• The minimum number of colors needed to color a graph so that
no edge connects vertices of the same color is called the
chromatic number.
2-Colorable Graph Theorem
• A graph is 2-colorable if and only if it has no circuits that consist
of an odd number of vertices.
Four-Color Theorem
• The chromatic number of a planar graph is at most 4.
Example 1:
• Consider the complete graphs K4 and K5 .
• Determine their chromatic number.
Solution:
• First, assign vertex A with one color, say
red, then vertex B with another color,
say blue.
• Since you cannot color two adjacent
vertices using the same color, use green
to color the vertex C, and finally, yellow
to color the vertex D.
• Thus, K4 is fourcolorable.
• It is important to note that K4 is planar,
hence the Four-Color Theorem is
satisfied.
Solution:
• Previously, it is seen that K5 is not
planar so the Four-Color Theorem does
not hold here.
• Now, assign each vertex of the graph
with one color in such a way that no
two adjacent vertices have the same
color as shown below.
• Thus, the chromatic number of K5 is 5.
Example 2:
• Six college accreditation committees need to hold meetings on the
same day, but some teachers belong to more than one committee.
• In order to avoid members missing meetings, the meetings need
to be scheduled at different time slots.
• An “X” in the table on the next page indicates that the two
corresponding committees share at least one member.
• Use graph coloring to determine the minimum number of time
slots necessary to ensure that all faculty members can attend all
meetings.
Example 2:
Solution:
• First, draw a graph representing the six committees using six
vertices or nodes in any configuration.
• An edge connects two committees that share at least one
member.
• Then assign each vertex of the graph with one color in such a way
that no two adjacent vertices have the same color.
Solution:
• Obviously, the graph is not 2-colorable
because there are circuits of odd length,
but the graph is 3-colorable.
• Hence, the minimum number of time
slots necessary to ensure that all faculty
members can attend all meeting is 3.
• First time slot: Faculty Instruction,
Student Welfare
• Second slot: Faculty, Outreach Program
• Third slot: Library Facility, Physical
Facility
Example 3:
• The fictional map on the next
page shows the boundaries of
barangays on a rectangular
town.
• a. Represent the map of a graph
• b. Find a coloring of the graph
using the fewest possible
number of colors
• c. Color the map according to
the graph coloring theorem.
Solution:
• First, represent each barangay
using vertices A, B, C, D, E, F, G,
H, I, and J.
• Second, connect two vertices
with an edge if the two
barangays share the same
boundary.
• Third, color the vertices of the
resulting graph so that no edge
connects two vertices with the
same color. Coloring is not
unique.
Solution:
• Finally, color each barangay in
the map according to the color
of its assigned vertex in the
previous step.
Topic 5: Trees
• A tree is a mathematical structure which is a type of graph which
has the following properties:
• 1. undirected;
• 2. connected (each of the vertices is connected or linked to at
least one other vertex); and
• 3. acyclic (there is only on route from any vertex to any other
vertex or has no cycle).
• An example of a tree is the Philippine Judiciary Organization Chart
as shown in the figure below.
• Some common terminologies related to the graph of trees are
illustrated in the following diagram.
• A full m-ary tree is a tree in which all external vertices are at the
same time depth or has exactly m children.
• Tree T1 in the following figure has exactly two children per vertex
and hence is called a full binary tree.
• Tree T2 is a full ternary tree because each vertex has three child
vertices.
• The height of a rooted tree is
the number of edges along
the longest path from the
root vertex to the farthest
child vertex. Given a full m-
ary tree T of height h, T has:
• The most common application of the tree is determining the
number of matches that must be played to determine the
champion in a single elimination tournament.

Example 1
• A local basketball league implements a new ruling of single-
elimination wherein a team is eliminated after a single loss. If
there are 16 teams to compete in the tournament, how many
matches must be played to determine the champion?
Solution:
• The number of teams represent the terminal vertices so t =16. It is
a binary tree since there are two teams competing in each ball-
game, thus m = 2.
• Substituting the values of t and m to determine the number of
internal vertices, we get:

• Thus, there will be 15 matches before a champion will be


declared.
Answer Activity Sheet 21

You might also like