GRAPH THEORY
GRAPH THEORY
𝐸3 = { (x, y) } | 0 < |x – y| ≤ 2 }
Graph Concepts
Let
Definition
Let
V = {0, 1, 2, 3, 4, 5}, (magiging means ng Definition
ating vertices)
Vertices are said to be adjacent if there is an edge
𝐸1 = { (x, y) } x and y are either both odd or that joins them. Edges are said to be adjacent if they
both even} share a common vertex.
Let The degree of a vertex is the number of edges at
𝐺1 =(V , 𝐸1 ) = { (0,0), (0,2), (0,4), (1,1), (1,3), that vertex.
(1,5), (2,0), (2,2), (2,4), (3,1), (3,3), (3,5),
Special Case: For graphs with loops, you have to
(4,0), (4,2), (4,4), (5,1), (5,3), (5,5) }
add 1 to the degree of the vertex with loops
0 connect sa sarili nya as even
1 as odd and connect sa odd din
Example 1:
Determine the degree of each Vertex 𝐺1
In this graph, a vertex is vertices of 𝐺1 . 0 4
adjacent to itself. Such 1 4
edges are called loops. 2 4
3 4
4 4
5 4
=24
12 edges + 12 for loop
Example 2:
= 24.
Let
V = {0, 1, 2, 3, 4, 5},
𝐸2 = { (x, y) } | x ≠ y }
𝐺1 = (𝑉, 𝐸1 )
Let
(0 is not adjacent to 1 and 5 because there is no
𝐺2 =(V , 𝐸2 ) = { (0,1), (0,2), (0,3), (0,4), (0,5), edge that connects them.)
(1,0), (1,2), (1,3), (1,4), (1,5), (2,0), (2,1),
Always remember add 1 sa loop.
(2,3), (2,4), (2,5), (3,0), (3,1), (3,2), (3,4),
Example 2: A-D-E-B-A
Determine the degree of each vertices of 𝐺2 . A-C-B-E-D-A
Vertex 𝐺2
Definition
0 5
1 5 A graph G is said to be connected if there is a path
2 5
joining any two of its vertices. Otherwise, it is said to
3 5
be disconnected.
4 5
5 5
Example 3:
Determine the degree of each vertices of 𝐺3
Vertex 𝐺3
0 2
1 3
2 4
3 4
Example: (disconnected graph)
4 3
5 2
𝐺3 = (𝑉, 𝐸3 )
Definition
Eulers Theorems and Fleury’s Algorithm In this graph, paths A-B-C-A-D-F-G-D-E-A and D-A-
C-B-A-E-D-G-F-D are Euler circuits.
Euler Path, Euler Circuit
Example: Determine which of the following graphs Example: Determine if the given graph below has
has a bridge. an Euler circuit.
Vertices D and E have
odd degrees. Hence,
the given graph has no
Euler circuit.
Example: Determine if the given graph below has 1. Make sure that the graph is connected, and all
an Euler path. vertices have even degree.
2. Start at any vertex.
More than two vertices 3. Travel through an edge if:
have odd degrees. Hence,
3.1 it is not a bridge for the untraveled part, or
the given graph has no
Euler path. 3.2 there is no other alternative.
4. Label the edges in the order in which you travel
them.
5. When you can’t travel any more, stop.
Example: Using Fleury’s algorithm, and an Euler Example:
circuit.
Consider the given graph below.
Given a connected graph G. A Hamilton circuit is a The given graph has no Hamilton circuit.
circuit that passes through each vertex exactly once.
Weighted Graph
3.2 result in three chosen edges coming from the A spanning tree for a graph is a tree that results from
same vertex. the removal of as many edges as possible from the
original graph without making it disconnected.
4. Repeat Step 2 until the Hamilton circuit is
complete
Example:
Find two different spanning trees for the graph
shown below.
Tree
KRUSKAL’S ALGORITHM
Example:
Determine the minimum spanning tree in this
weighted graph.
With the six vertices already chosen, we have the Chromatic Number
required minimum spanning tree highlighted:
Given a graph coloring problem, the smallest
14 = / 27 = /
number of colors needed to color a graph is called
18 = / 30 = X the chromatic number.
20 = / 31 = X
21 = / 32 = X The Four-Color Theorem
24 = X 35 = X Every possible geographical map can be colored
with at most four colors in such a way that no two
adjacent regions have the same color.