Module 8 The Mathematics of Graph
Module 8 The Mathematics of Graph
diagram in Figure
5.1 could
represent friends
8.1 GRAPHS AND EULER CIRCUITS that are connected
on Facebook.
GRAPH THEORY - Each dot
- Graph theory had its beginning in 1736. represents a
- Pregel River in Konigsberg City (located in person, and a line
modern-day Russia and now called segment connecting
Kaliningrad) two dots means that those two people are
friends on Facebook.
- This type of diagram is called a graph.
WHAT IS A GRAPH?
- A graph is a set of points called vertices and
line segments or curves called edges.
INTRODUCTION TO GRAPHS
- Think of all the various connections we
experience in our lives - friends are connected
on Facebook, cities are connected by roads, Null graph - no edge is Simple graph - does not
computers are connected across the internet. drawn between any two have more than one
- A branch of mathematics called graph theory vertices edge between two
illustrates and analyzes connections such as vertices and no edge
starts and ends at the
these. same vertex. A graph
without loops and
multiple edges.
graph in Figure 5.4, one path would be
Not a simple graph Complete graph - where
every possible edge is A-B-A-C.
drawn between the
vertices. Closed path
- If a path ends at the same vertex at which it
started, it is considered a closed path or circuit.
A-D-F-G-D-B-E-G-H-E-C-B-A
A Tree graph - an Equivalent graphs - two
undirected graph in or more graphs are - If starts with B:
which any two vertices equivalent if the edges
are connected by form the same B-A-D-F-G-D-B-E-G-H-E-C-B
exactly one path, or connections of vertices.
equivalently a connected - Are these graphs DEGREE OF A VERTEX
acyclic undirected graph. below equivalent
- The number of edges that meet at a vertex is
graphs?
called the degree of a vertex.
Euler’s Circuit
- Any graph that has an even degree at every
vertex must have an Euler’s circuit.
- A graph that has an Euler’s circuit is called
Eulerian.
Equivalent graphs
- Are the two graphs equivalent?
WHAT IS A PATH?
- A path in a graph can be
thought of as a movement from
one vertex to another by
traversing edges. We can refer
to our movement by vertex
letters. For example, in the
APPLICATION OF EULER PATH THEOREM
DIRACH’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.
Is this graph Hamiltonian?
Solution 1:
WEIGHTED GRAPHS
- A weighted graph is a graph in which each
edge is associated with a value called weight.
THE GREEDY ALGORITHM
- Objective: to find the minimum weight provided
1. Choose a vertex to start at, then travel along
all vertices are visited.
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 circuit and does not add a third marked edge
until you have visited all vertices. to a single vertex.
3. Return to the starting vertex. 3. Continue this process until you can no longer
mark any edges. Then mark the final edge that
Example: completes the Hamiltonian circuit.
Use the greedy algorithm to find a Hamiltonian
circuit in the weighted graph. Solution:
We first highlight the edge of the smallest
weight, namely BD with weight 2.
Solution:
Begin at A. The weights of the edges from A
are 13, 5, 4, 15, and 8. The smallest is 4. Connect A to
D.