MMW Reviewer Lesson 5 and 6
MMW Reviewer Lesson 5 and 6
MMW Reviewer Lesson 5 and 6
Graph Concepts
Note:
Definition:
a. Vertices are adjacent if there is an edge that
• Let V be a non-empty set and E be any set joins them. Similarly, Edges are adjacent if
of ordered pairs over V. (V, E) is called graph there share a common vertex.
denoted by G = (V, E). b. The degree of vertex is the number of edges
- V is vertex set of G and its elements are at that vertex.
vertices. c. Special Case: For graphs w/ loops, you must
- E is edge set of G and its elements are add 1 to the degree of the vertex with
edges. loops.
Example #1 Example #1
Example #2 Example #2
Example #3 Example #3
Moreover, we can visualize graphs thru the ff.
• Given a graph G = (V, E). A path in G is a models.
sequence of vertices w/ no repeated edges.
• Given a graph G = (V, E). A circuit in G is a path
that starts and ends at the same vertex.
Example#1
Euler Path & Euler Circuit Euler’s Theorem 2
• Given a connected graph G. An edge in G is 1. If a graph has more than two vertices of odd
bridge if G becomes disconnected when it is degree, then it cannot have a Euler path.
deleted. 2. If a graph is connected and has just two
- A Euler path is a path that travels vertices of odd degree, then it has at least
through every edge of G. one Euler path. Any such path must start at
- A Euler circuit is a circuit that travels one of the degree vertices and end at the
through every edge of G. other one.
Example #1 Example
Euler’s Theorem 3
Example
Euler’s Theorem 1
Example #1
Fleury’s Algorithm for Finding Eulerian Circuit
Example:
Hamilton Path
Hamilton Circuit
Example:
Note:
Now, n-1 = 5 – 1 = 4.
Note: The last example is similar with the last Note: Not advisable to use when the graph is too
example in the previous image. big.
Weighted graph
Example:
There are a lot of ways to solve this, but here are Also known as Djikstra Algorithm. However,
the methods that will be used: Djikstra Algo can also be applied to graph that
doesn’t require circuit. In this case since we are
looking for a circuit, then it’s called Cheapest Link
Algo.
Tree Minimum Spanning Tree
- A graph in which any two vertices are - Spanning tree for that graph that has
connected by exactly one path. the smallest possible sum of the
weights.
- To find the minimum spanning tree you
can use Kruskal’s Algorithm.
Example:
Spanning Tree
Planar Graph
Chromatic Number
Example:
Lesson 5: Linear Programming
- Linear Programming – a mathematical
method in maximizing or minimizing linear
functions subject to set of linear constrain.
HB. 1
Answers (hint):
Theorem: