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

Module 6. Mathematics of Graphs (1)

Module 6 covers the fundamentals of graph theory, detailing its historical development, definitions, and applications across various fields such as transportation, telecommunications, and neuroscience. It explains key concepts like Eulerian and Hamiltonian graphs, their properties, and how to model real-life situations using graphs. Additionally, the module includes exercises to reinforce understanding and application of graph theory principles.

Uploaded by

luna
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)
10 views95 pages

Module 6. Mathematics of Graphs (1)

Module 6 covers the fundamentals of graph theory, detailing its historical development, definitions, and applications across various fields such as transportation, telecommunications, and neuroscience. It explains key concepts like Eulerian and Hamiltonian graphs, their properties, and how to model real-life situations using graphs. Additionally, the module includes exercises to reinforce understanding and application of graph theory principles.

Uploaded by

luna
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

Module 6

Mathematics of Graphs
Introduction
The middle part of the 18th century saw the birth and the
expansive evolution of graph theory as a branch of mathematics.
Coming from an unusual origin, graph theory has developed into
one of the richest fields of mathematics in terms of applications
and theory.
Introduction
Unlike a “graph” that you learned in algebra and calculus (e.g.
polynomial graphs, exponential graph), or those that you
encountered in statistics (e.g. bar graph, pie chart), “graph” in
graph theoretic context is much simplified as consisting of points
(or vertices) and lines (or edges) and has no regard to
coordinates and distances.

The focus is the way points are connected.


Introduction
Over the years, graph theory has grown to be a powerful tool to
simplify and provide solutions to various real-life problems. It is
widely used in transportation to simulate virtual maps that can
provide optimal routes when travelling, in telecommunications to
build complex yet efficient network topologies including the
internet, and many more. It has found its way into the streams of
biology, chemistry, environmental science, sociology, psychology
and other fields.
Where are graphs used?

In teaching, we can use graphs to summarize interdependence


of topics that will be discussed in a whole academic term (topic
flowchart)
Where are graphs used?

In “social” network:
Where are graphs used?

In neurology, nerve regions are modelled with a web of signals


from one to another.
Where are graphs used?
• The brain can be regarded as a network: a connected
system where nodes, or units, represent different
specialized regions and links, or connections,
represent communication pathways. From a
functional perspective, communication is coded by
temporal dependence between the activities of
different brain areas.
• Nowadays, the use of graph analysis in translational
neuroscience has become essential to quantify brain
dysfunctions in terms of aberrant reconfiguration of
functional brain networks.
Where are graphs used?

In the stock market :


Where are graphs used?

In biochemistry:
Where are graphs used?

In Chemistry
Where are graphs used?

In communication network
Objectives
❑ Lay out the basic concepts of graph theory that are considered
essential in modeling real-life situations.
❑ Use graph theory approach to analyze and find solutions to real-life
problems.
❑ Apply algorithms to solve problems on Hamiltonian graphs, Eulerian
graphs, weighted graphs, planar graphs and coloring problems
including their applications to real-life situations.
Section 6.1 Modeling with Graphs
Historical Background : The Konigsberg Bridge Problem
https://www.youtube.com/watch?v=nZwSo4vfw6c
Intended Learning Outcomes
At the end of the module, students should be able to:

1. State and explain the formal definition (set theoretic) of a


graph;

2. Configure a graph in several ways and determine if a graph is


indeed realizable; and

3. Set-up graph models for real-life situations.


Definition

A graph is a set of points called vertices and line segments


called edges that connect vertices.
Definitions
A graph, usually denoted as G, has two important components:
i) V - a set of vertices (or nodes)
ii) E - a set of edges (or lines) E.
The set E consists of pairs of the elements of V.

If the pairs are ordered, then the resulting graph is said to be directed,
otherwise it is undirected. In both cases, we specify a graph G as
G = (V,E).
The cardinality of V is referred to as the order of the graph while the
cardinality of E is its size.
Definitions
If 𝑥 and 𝑦 are vertices of a graph G, that is, 𝑥, 𝑦 ∈ V then an edge 𝑒 can
be denoted as 𝑒 = (𝑥, 𝑦) ∈ E. In this case, the vertices 𝑥 and 𝑦 are said
to be adjacent and that the edge 𝑒 is incident on 𝑥 (or on 𝑦).

The degree of a vertex is the number of edges incident to it, or


equivalently, the number of vertices that are adjacent to it.
Example 1 : Simple Undirected Graph
G = ({A,B,C,D,E,F},{{A,B},{A,C},{A,D},{D,E},{D,F}}) = (V,E)

V E B A C

order: |V| = 6
size: |E| = 5

E D F
Example 1 : Simple Undirected Graph
G = ({A,B,C,D,E,F},{{A,B},{A,C},{A,D},{D,E},{D,F}}) = (V,E)

V E B A C

order: |V| = 6
size: |E| = 5

E D F
Example 1 : Simple Undirected Graph
G = ({A,B,C,D,E,F},{{A,B},{A,C},{A,D},{D,E},{D,F}}) = (V,E)

V E B A C
For brevity, use AB to mean the edge {A,B}.

G = ({A,B,C,D,E,F},{AB,AC,AD,DE,DF}).

Vertex degrees:
Vertex A B C D E F

Degree 3 1 1 3 1 1
E D F
Exercise
Let V = {A, B, C, D, E} and E = {AB, AC, AE, BC, BD, CE}. Draw the
corresponding graph and find the following:
a. order of G
b. size of G
c. degree of the vertices
Remarks
a. The lengths of the edges do not matter.
b. The location of the vertices does not matter.
c. Edges are not limited to straight lines; curved lines (or arcs) may
also be used.
d. The relative placement of the vertices does matter.
e. Graphs may appear different in form but as long as the adjacency is
followed based on the edge set E, then such graphs refer to the same
graph (isomorphism of graphs).
Isomorphic Graphs

G = ({A, B, C, D, E}, {AB, AC, AE, BC, BD, CE})


Graph Model
Consider five barangays B1, B2, B3, B4, and B5 all located in Manila. A
certain agency involved in community development is implementing a
new project in these five barangays and is interested to know how the
residents can access the nearby barangays. The clustered map of these
barangays is shown below. Set up a model for the five barangays.
Graph Model
Example: On Social Network
Teacher Ed is examining how his six students, Kim, Ken, Joel, Tom,
Jon and Migs, are connected in Facebook(FB). His initial data revealed
the following information (a check mark means being FB friends)
Graph Model
Types of Graphs
Directed Graphs

H = ({A,B,C,D,E,F},{(A,C),(A,B),(B,A),(D,A),(B,E),(B,F)})
Directed Graphs
Because of the direction, there is a need to identify the initial and
terminal vertices, like in the edge (A,B), vertex A is the initial while
vertex B is the terminal vertex. Edges that are directed towards a
vertex comprise the in degree of the vertex while those that are
directed away comprise the out degree.
Types of Graphs
Multigraph

G = ({A,B,C},{AB,AB,AB,BC,CC})

Multi-edge Loop
Types of Graphs
Null Graph

G = ({A,B,C}, ∅ )
Types of Graphs
Paths
Types of Graphs
Cycles
Types of Graphs
Complete Graphs
Exercise
In their effort to improve the research
culture among students and teachers, five
universities in Metro Manila have agreed to
open their libraries for mutual utilization.
The table below summarizes which school
can use the library services of another
school. An “X” mark simply means that
students and faculty of the involved
universities can use both their library
services.
Exercise
a. Draw the graph according to the
“X” marks in the table.
b. Which school is most liberated
when it comes to accepting
students and faculty from other
schools?
c. Which school is least liberated?
Exercise
Five individuals met to discuss a
new business venture. Before the
meeting started, they shook hand
with each other. The graph below
shows the handshakes that took
place. An edge connect two persons
if they shook hands before the
meeting.
Exercise
a. Did JC and Dex shake hands?
b. How many individuals did Prince
shake hands with?
c. Among the five individuals, who
shook hands with most people in
the meeting?
d. Would it make sense if the graph
has a multiple edge?
e. Would it make sense if the graph
has a loop?
Section 6.2 Hamiltonian and Eulerian Graphs

The Königsberg bridge problem centers on traversing the vertices of a graph by


passing through each edge only once. With Euler’s elegant approach in solving the
puzzle, all other related problems were referred to his credit, giving birth to the
concept of Eulerian graphs.
A similar issue was the Travelling Salesman Problem, studied by Sir William Rowan
Hamilton in mid-19th century. This time, the objective is to find the shortest
possible route to traverse the graph passing through each vertex once. This gave
rise to the concept of Hamiltonian graphs.
Learning Outcomes
At the end of the section, students should be able to:

1. Define and illustrate an Eulerian graph;


2. Define and illustrate a Hamiltonian graph and
3. Use the properties of Eulerian and Hamiltonian
graphs to solve practical problems.
Definitions
Given a graph G, a walk is a sequence
of adjacent vertices. For example, the
sequence A-B-C-E-F-A-G in the graph
(see figure on the left) traces a walk
from A to G. This has length 6 since
there are 6 edges traversed in the said
walk. A walk is said to be closed if the
first and last vertices are the same.
Definitions
If a walk has no repeated vertex, then it is
called a path.The walk A-B-C-E-F-A-G is not
a path since the vertex A appeared twice.
Rather, the walk A-B-C-E-F is a path.
Meanwhile, if a walk does not have
repeated edges, then it is called a trail.
Note that A-B-C-E-F-A-G is a trail.

In general, every path is a trail but not


otherwise. A closed path is called a cycle,
while a closed trail is called a circuit.
Definitions
A circuit (or a trail) is said to be Eulerian if it
traverses all the edges of the graph. On the other
hand, a cycle (or a path) is Hamiltonian if it
traverses all the vertices of the graph.

A graph that contains an Eulerian circuit is called


an Eulerian graph. Likewise, a graph that has a
Hamiltonian cycle is called a Hamiltonian graph.

Is the graph in the graph on the left Eulerian? Is it


Hamiltonian? Can you specify the Eulerian circuit
and the Hamiltonian cycle if they exist?
Eulerian Graph

Graph model of the Konigsberg map


The Eulerian Graph Theorem
A connected graph is Eulerian if and only if every vertex
of the graph is of even degree.

Euler’s reasoning was simple, to be able to visit a vertex (other


than the starting vertex), two edges are needed, one for entry
and the other for exit.
The Eulerian Path Theorem
A connected graph contains an Euler path if and only if
the graph has 2 vertices of odd degree with all other
vertices of even degree. Furthermore, every Euler path
must start at one of the vertices of odd degree and must
end at the other.
Eulerian Graph
In the case of the Konigsberg graph, all vertices are of odd degree; A is
of degree 5, B is of degree 3, C is of degree 3 and D is of degree 3.
Indeed, it will be impossible to go around the area without crossing
any bridge twice. More so, it is not even possible to walk through the
area from one land area to all the other land areas without crossing a
bridge more than once.
Exercise
Which graph is Eulerian? Which graph is not Eulerian but contains an
Eulerian path?
Example
The floor plan of a warehouse is illustrated below. Use a graph to
represent the floor plan, and answer the following questions: Is it
possible to walk through the warehouse so that you pass through
every doorway once but not twice? Does it matter whether you return
to the starting point?
Example
Exercise
A map of South America is shown on the right.
a. Draw a graph in which the vertices represent the
13 countries of South America and two vertices are
joined by an edge if the corresponding countries share a
common border.
b. Two friends are planning a driving tour of South America.
They would like to drive across every border on the
continent. Is it possible to plan such a route that never
crosses the same border twice? What would the route
correspond to on the graph?
c. Find a route the friends can follow that will start and end
in Venezuela and that crosses every border while re-
crossing the fewest borders possible.
Hamiltonian Graphs
Unlike Eulerian graphs, there is no straightforward condition that can
determine whether a graph is Hamiltonian or not. Perhaps the more
popular theorem that can serve this purpose is the one proposed by G.
A. Dirac in 1952.
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 n/2, then the graph must be Hamiltonian.
Example
The order of the graph is 5, half of
which is 2.5 or 3. Since each vertex is
of degree 4 which is greater than 3,
then Dirac’s theorem guarantees that
the graph is Hamiltonian.

Indeed, because the cycle A-B-D-E-C-


A is a Hamiltonian cycle in G.
Remark

Dirac’s Theorem only provides a sufficient (but not necessary)


condition for Hamilton city. This means that it remains inconclusive if
the minimum degree among the vertices of the graph is less than n/2.

Hamiltonian?
Illustration: Hamiltonian?

The graph is of order 6 and half of this number is 3. The minimum degree of the
graph is only 2 (at vertices A and E). By this, Dirac’s Theorem is no longer
applicable and so we cannot test the hamiltonicity on the basis of the said
theorem. By trial and error, we can test the hamiltonicity. In fact, we can easily
trace a Hamiltonian cycle: A-B-E-F-D-C-A. Thus, the graph is Hamiltonian.
Exercise: Which graph is Hamiltonian?
Example
A large law firm has offices in seven major cities. The firm has overnight document
deliveries scheduled every day between certain offices. In the graph below, an
edge between vertices indicates that there is delivery service between the
corresponding offices. Use Dirac’s theorem to answer the following question:
Using the law firm’s existing delivery service, is it possible to route a document to
all the offices and return the document to its originating office without sending it
through the same office twice?
Section 6.3 Weighted Graphs
In many applications, you can use the edges or the vertices of a graph to represent
real-life metrics. In navigation, for example, the vertices may mean destinations
while the edges may mean the distance or cost of traveling from one point to
another. In communication network, the edges may indicate loading capacity.
Informally, any value that is assigned to the edges is called weight. In such cases,
the question of whether the graph is Eulerian or Hamiltonian should no longer be
constrained to utilizing the vertices or edges of the graph, but to make the process
more efficient by optimizing the weights in the graph.
Assigning weights to the edges of a graph is the labeling aspect of a graph. Graph
labeling has become one rich area of graph theory in terms of research
opportunities because of the unlimited areas where this concept can be applied.
Learning Outcomes
At the end of the section, students should be able to:
1. define and illustrate a weighted graph;
2. explain and execute algorithms for identifying
Hamiltonian cycles in weighted graphs; and
3. use the algorithms to solve practical problems about
weighted graphs.
Definitions

A 8 B
- A graph is considered weighted if its
edges are assigned numeric values 2
called weights.
6 3
- A weighted graph is a graph where 4
every edge has associated numeric
value (called weight) 5
D C

Weighted K4
Illustration
A 8 B
One problem that can be addressed with weighted
graphs is to traverse all the vertices through the least
2
total weights possible.
Examine the total weights for all possible Hamiltonian 6 3
cycles of the weighted K4 shown on the right. 4

D 5 C

Weighted K4
The Greedy Algorithm

1. Choose a vertex to start at, 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
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: Illustration
A 8 B
1. Suppose we start at vertex A. By the
algorithm, we proceed to vertex C, as the
2
weight 4 is the least compared to vertex B
(weight 8) or to vertex D (weight 6). 6 3
2. From vertex C we proceed to vertex B 4
(weight 3 vs 5 of D). Then to D (weight 2).
3. Go back to A with the weight 6. D 5 C

The cycle A-C-B-D-A accumulates a total weight


of
4 + 3 + 2 + 6 = 15
A limitation
1. Suppose we start at vertex B. In this case, A 8 B
we pick D next.
2. From vertex D we proceed to vertex C, then 2
to vertex A. 6 3
3. Go back to B with the weight 8. 4

The cycle B-D-C-A-B accumulates a total weight


5 C
of D
2 + 5 + 4 + 8 = 19 (not minimum)
The Edge-Picking Algorithm
1. Mark the edge with the least weight (choose arbitrarily if the least weight is
carried by 2 or more edges).
2. Mark the edge with the second least weight. Take note of the following:
i. Choose arbitrary edge in cases of tied weights.
ii. Do not choose an edge if it completes a cycle.
iii. Do not choose an edge if it becomes the third marked edge incident to a
single vertex.
3. Keep repeating Step 2 until there is no more edge available.
4. Mark the last edge that will complete the Hamiltonian cycle.
The Edge-Picking Algorithm: Illustration
A 8 B A 8 B A 8 B A 8 B

2 2 2 2

6 3 6 3 6 3 6 3
4 4 4 4

D 5 C D 5 C D 5 C D 5 C

2 + 3 + 4 + 6 = 15
Example
Egay is tasked to distribute examination papers during the quarterly examination
of the mathematics department. From the office, he has to bring the test papers
and answer sheets to four examination areas in the campus: North Building, South
Building, West Building, and Southwest Building. The table below summarizes the
roaming time from one area to other areas. Determine the roaming route that
gives the least time for the distribution of the examination materials.
Example
Example

Using the Greedy Algorithm:


Office-North-West-Southwest-South-Office
Sum of weights:
7 + 5 + 4 + 3 + 9 = 28
It can take 28 minutes for Egay to finish the
distribution.
Example
Using the Edge-Picking Algorithm:
Order of edge Edge Weight (time)
1st Southwest – South 3
2nd Southwest – West 4
3rd West – North 5
4th North – Office 7
5th (closing) Office – South 8
TOTAL TIME 28

Possible routes:
Office-South-Southwest-West-North-Office
Office-North-West-Southwest-South-Office
Exercise
The cost of flying between
various European cities is
shown in the following
table. Use both the greedy
algorithm and the edge-
picking algorithm to find a
low-cost route that visits
each city just once and
starts and ends in London.
Which route is more
economical?
Section 6.4 Graph Coloring
Graph coloring is another aspect of graph labeling. Here, the main objective is to
color the vertices of the graph with the least possible number of colors such that
no two adjacent vertices share the same color. Although this may appear just yet
another tricky mathematical problem, graph coloring has found its way into
countless applications of practical values.
The accelerated interest in graph theory can be attributed to graph coloring. In
fact, it took almost a hundred years for a classical problem to be settled—the Four
Color Theorem. It states that if a graph can be drawn such that its edges do not
intersect, then it takes no more than four colors for its vertices to be colored
(again, no two adjacent vertices share the same color).
Learning Outcomes
At the end of the section, students should be able to:
1. define graph coloring;
2. illustrate proper coloring of a graph;
3. specify the conditions and procedures of implementing
proper coloring of graphs; and
4. use the concept of graph coloring to solve real-life
problems.
Introduction: Planar Graphs

Graph coloring traces direct links to planar graphs. A graph is


said to be planar if it can be drawn such that no edge
intersect each other (except at the vertices).

Planarity of graphs was also conceived as a puzzle-type


problem.
Introduction: Planar Graphs
Three utility companies each need to run pipes to three houses. Can they do so
without crossing over each other’s pipes at any point? The puzzle is illustrated in
the figure below. Go ahead and try to draw pipes connecting each utility company
to each house without letting any pipes cross over each other.
Introduction: Planar Graphs
When modelled as a graph, we can configure the following:

The graph on the right is called the Utility Graph, usually denoted as K3,3.
Introduction: Planar Graphs
The Utility Graph is NOT PLANAR………………….and so is the complete graph K5.
Non-Planar Graph Theorem

A graph is nonplanar if and only if it has the Utilities Graph or


the K5 as a subgraph.
Euler’s Formula

In a connected planar graph drawn with no intersecting


edges, let 𝑣 be the number of vertices, 𝑒 the number of edges,
and 𝑓 the number of faces. Then
𝑣+𝑓 =𝑒+2
Graph Coloring

https://www.youtube.com/watch?v=RSSfO0lnEp8
Graph Coloring

Graph coloring is the process of assigning colors to the


vertices of a graph. The coloring is said to be proper if no two
adjacent vertices are assigned the same color. The minimum
number of colors for a proper coloring to be possible is called
the chromatic number of the graph G, denoted by χ(G) . If the
chromatic number of a graph is k, then the graph is said to be
k-colorable. Note that if a graph is k-colorable, then it can
also be colored by more than k colors.
Example
Let us try to exhibit a (proper) coloring of the graph shown on A
the right. First, color vertex A with red. This forces a different
color to the vertices B, C, E, and F since these 4 vertices are all
adjacent to A. C
B

E F
Example
Let us try to exhibit a (proper) coloring of the graph shown on A
the right. First, color vertex A with red. This forces a different
color to the vertices B, C, E, and F since these 4 vertices are all
adjacent to A. C
B

E F
Example
Let us try to exhibit a (proper) coloring of the graph shown on the A
right. First, color vertex A with red. This forces a different color to
the vertices B, C, E, and F since these 4 vertices are all adjacent to
A. C
B
Let us assign blue to B.
D
This also permits C to be assigned blue also (why?).
A new color, say green, has to be assigned to E since it is adjacent
to C. Similarly, F may be assigned a green color.
Finally, since D is not adjacent to D, this vertex can also use red.
E F
Thus, we need only 3 colors to exhibit a coloring of the graph.
This shows that 𝜒(G) = 3, or that the graph is 3-colorable.
Remarks

1. A graph is 2-colorable if and only if it does not contain a


cycle that has odd number of vertices.
2. The chromatic number of a planar graph is at most 4.
Otherwise, more colors are needed to implement proper
coloring.
Application: Scheduling
During the final examination, each subject is
allotted 2 hours for students to finish. The
available slots are 8-10 a.m., 10 a.m.12 noon, 1-
3 p.m., and 3-5 p.m. The table below
summarizes the possible conflicts for students
to take simultaneous examinations. A mark “X”
indicates that the subjects have common
students.
Can all final examinations be administered in
one day?
Which examination can be taken by students at
the same time slot?
Application: Scheduling

M15 M21 M15 M21

M30 M22 M30 M22

M24 M23 M24 M23


Application: Scheduling
The result of the graph coloring indicates that there should be four time slots for
the 6 subjects. A possible schedule would then be:
8:00 AM – 10 AM ------------Math 15
10:00 AM – 12:00 PM ------Math 30 and Math 21
1:00 PM – 3:00 PM ----------Math 23
3:00 PM – 5:00 PM ----------Math 24 and Math 22

Thus, all examinations can be administered in just one day.


Application: Traffic Light
Graphs can be used to represent
traffic patterns using the traffic
paths as vertices of the graph. Two
vertices are adjacent if a collision is
possible when the corresponding
paths are open. By coloring the
resulting graph using the least
possible number of colors,
determine the least number of
turns that the traffic light can allow
to avoid collision.
Application: Traffic Light

A B

F C

E D
Application: Traffic Light

A B

F C

E D
Application: Traffic Light

The colors indicate that the traffic light needs to have 4


stages.
Stage 1 (Red): Paths A and B are open.
Stage 2 (Green): Path C is open.
Stage 3 (Blue): Paths D and F are open.
Stage 4 (Yellow): Path E is open.
Exercise
During the annual conference of a
professional organization, nine topics
were proposed for simultaneous
plenary discussions. However, some
topics need to be scheduled in
different time slots. The table
summarizes which topic cannot be
discussed in the same schedule.
a. How many time slots should be
scheduled?
b. Which topic should be included in
each time slot?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy