0% found this document useful (0 votes)
14 views44 pages

Chapter 8. Graphs (Part 1)

MATHEMATICS graphs
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)
14 views44 pages

Chapter 8. Graphs (Part 1)

MATHEMATICS graphs
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/ 44

GRAPHS

Learning Objectives:

In this topic, you should be able to:


1. define a graph;
2. describe some types and families of graphs;
3. find Eulerian paths and circuits; find Hamiltonian
paths and circuits; and
4. solve real-world problems involving Eulerian and
Hamiltonianpaths and circuits.
Challenge… The Konigsberg Problem

Can you walk through each bridge exactly


once?
Challenge… The Konigsberg Problem

Can you walk through each bridge exactly


once?
Challenge… The Konigsberg Problem

Can you walk through each bridge exactly


once?
Challenge… The Konigsberg Problem

Can you walk through each bridge exactly


once?
GRAPH THEORY
- a branch of mathematics which
illustrates and analyzes connections
between objects.
TERMINOLOGIES
• A graph a set of points called vertices and line
segments or curves called edges.
• Two vertices are adjacent if they have a common edge.
• A loop is an edge, the endpoints of which are the same
vertex.
• Multiple edges are two or more edges that are
incident to the same two vertices.
• The degree of a vertex is the number of edges incident
to that vertex.
EXAMPLE

1. Enumerate the vertices.


2. Determine which vertices are adjacent to
(a) San Francisco, (b) New York, and (c) Chicago.
3. Does this graph have a multiple edges?
4. What is the degree of the vertex New York?
Types of Graphs
A graph is a simple graph if it has no loops or
multiple edges.
Types of Graphs
A graph is a multigraph if it has multiple edges.
Types of Graphs
A graph is a pseudograph if it has a loop.
Types of Graphs
A graph is connected if there is at least a path that
connects two vertices while a graph is disconnected if it
is not connected.
Types of Graphs
A graph is a null graph if no edge is drawn between
any two vertices.

5 2

4 3
Types of Graphs
A complete graph is a graph in which every possible
edge is drawn between the vertices.
Types of Graphs
A graph is a directed graph where all the edges are
directed from one vertex to another. It is also called a
digraph.
Equivalent Graphs
Two or more graphs are equivalent if the edges
form the same connections of vertices.

Are these two graphs equivalent?


PATH A path in a graph is a sequence of edges which joins
a sequence of distinct vertices.

𝑢1 − 𝑢5 − 𝑢2 − 𝑢3 𝑣5 − 𝑣4 − 𝑣3 − 𝑣1 − 𝑣2
CIRCUIT A circuit is a closed path/cycle where a path ends
at the same vertex at which it started.

𝒖𝟏 − 𝑢5 − 𝑢2 − 𝑢3 − 𝒖𝟏 𝒗𝟏 − 𝑣2 − 𝑣3 − 𝑣4 − 𝑣5 − 𝒗𝟏
EULER PATH EULER CIRCUIT
It is a path where each It is a circuit where each
edge in a graph is edge in a graph is traversed
traversed once and starts once and starts and ends at
and ends at a different the same vertex.
vertex.

𝟏−2−3−4−5−1−𝟒 𝟏−2−3−4−5−𝟏
EULERIAN PATH AND CIRCUIT THEOREMS
Eulerian Graph Theorem
A connected graph is Eulerian if and only if every vertex
of the graph is of even degree. Furthermore, the graph is
Eulerian if it has an Euler circuit.

Euler Path Theorem


A connected graph contains an Euler path if and only if
the graph has two vertices of odd degree with all other
vertices of even degree.
Which of the following has an Euler path?
APPLICATION OF EULERIAN GRAPH THEOREM

Is it possible to
plan a journey that
traverse the tracks
and returns to the
starting point
without traveling
through any
portion of a track
more than once?
APPLICATION OF EULER PATH THEOREM

Is it possible for the


photographer to
design a trip that
traverses all the
roads exactly once?
APPLICATION OF EULER PATH THEOREM

Is it possible for the


cyclist to traverse all
of the trails without
repeating any
portions of the trip?
APPLICATION OF EULER PATH THEOREM
APPLICATION OF EULER PATH THEOREM

𝑩 𝑪 𝑫

𝑬
𝑨 𝑭
HAMILTONIAN CIRCUIT It is a cycle where each vertex is
traversed exactly once and starts
and ends at the same vertex.

HAMILTONIAN PATH It is a path where each vertex is


traversed exactly once and starts and
ends at the different vertices.

HAMILTONIAN A graph is Hamiltonian if and only if it has a


Hamiltonian circuit.

Historical background
William Rowan Hamilton (1805-1865) – Irish
mathematician who studied ”Hamiltonian” circuits
Example: Consider 𝒖𝟏 as a starting vertex.

Hamiltonian Path Hamiltonian Circuit


𝒖𝟏 𝒖𝟏

𝒗𝟏 𝒗𝟏
𝒖𝟓 𝒖𝟐 𝒖𝟓 𝒖𝟐
𝒗𝟓 𝒗𝟐 𝒗𝟓 𝒗𝟐

𝒗𝟒 𝒗𝟑 𝒗𝟒 𝒗 𝟑
𝒖𝟒 𝒖𝟑 𝒖𝟒 𝒖𝟑
𝑢1 − 𝑢2 − 𝑢3 − 𝑣3 − 𝑣2 𝑢1 − 𝑢2 − 𝑢3 − 𝑣3 − 𝑣2
− 𝑣1 − 𝑣5 − 𝑣4 − 𝑢4 − 𝑢5 − 𝑣1 − 𝑣5 − 𝑣4 − 𝑢4 − 𝑢5
− 𝑢1
DIRAC’S THEOREM

Dirac’s Theorem
Consider a connected graph with at least three
vertices and no multiple edges. Let 𝒏 be the number of
vertices in the graph. If every vertex has a degree of at
𝒏
least , then the graph must be Hamiltonian.
𝟐

Note:
If the given graph does not meet the requirements of
Dirac’s theorem, it still might be Hamiltonian.
DIRAC’S THEOREM

Example: Is the graph below Hamiltonian? What does the


Hamiltonian circuit represent in terms of flights?
DIRAC’S THEOREM

Example: Is the graph below Hamiltonian? What does the


Hamiltonian circuit represent in terms of flights?
MORE EXAMPLES

Find a Hamiltonian circuit for each graph.


EXERCISES
Find a Hamiltonian circuit for each graph.

a. b.
WEIGHTED GRAPHS It is a graph where each edge is
associated with a value called
weight.

• Each edge’s weight represents


the cost to travel along that
edge.
• The cost could be distance,
length, time, money, or some
other measure.
• The cost depends on the
underlying problem.
WEIGHTED GRAPHS
New York

713

597 Washington, DC
Chicago
748

544
803
1185
1374
665
Dallas 1299 Philadelphia
585
670

Atlanta
ALGORITHMS IN COMPLETE GRAPHS

The Greedy Algorithm


It is an algorithm that finds a solution to problems in the
shortest time possible. It makes us choose the cheapest
option at every chance we get.

Steps in Greedy Algorithm


1. Choose a vertex to start at.
2. Travel along the connected edge that has smallest
weight. If two or more edges have the same weight,
pick one.
3. Repeat step 2 until you have visited all the vertices.
4. Return to the starting vertex.
ALGORITHMS IN COMPLETE GRAPHS

The Greedy Algorithm

1. Choose a vertex to start at.


2. Travel along the connected
edge that has smallest weight.
If two or more edges have the
same weight, pick one.
3. Repeat step 2 until you have
visited all the vertices.
4. Return to the starting vertex.
ALGORITHMS IN COMPLETE GRAPHS

The Edge-Picking Algorithm


1. Mark the edge of smallest weight and the vertices
incident to it. If two or more edges have the same
weight, pick any.
2. Mark the edge of the next smallest weight in the graph
and the vertices incident to it, as long as it does not
complete a circuit and does not add a third mark to a
vertex.
3. Repeat step 2 until you can no longer mark any
edges/vertices.
4. Mark the final edge to complete the Hamiltonian circuit.
ALGORITHMS IN COMPLETE GRAPHS
The Edge-Picking Algorithm
Use the edge-picking
algorithm to find a
Hamiltonian circuit in the
weighted graph shown.
BD AD, BF & AE, CE CF
, ,
A-D-B-F-C-E-A
4+2+5+14+6+5=36
ALGORITHMS IN COMPLETE GRAPHS

From the example, the two algorithms


gave different Hamiltonian circuits.

The edge-picking algorithm gave the


more efficient route.

Is this the most efficient route?


ALGORITHMS IN COMPLETE GRAPHS

A-D-F-B-C-E-A

4+7+5+6+6+5=3
3
ALGORITHMS IN COMPLETE GRAPHS
(Check your progress 3 & 4)
A. Use the Greedy algorithm and the Edge-picking algorithm to
find a Hamiltonian circuit. State the corresponding weight.

• Which gave a more efficient


route? Why?

• Is there another more efficient


route? State the route and its
corresponding weight.
End of Discussion…

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