MMW Reviewer Lesson 5 and 6

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Lesson 6: Graph Theory

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 for paths

Example for circuit

• A graph is connected if there is a path


joining any two of its vertices. Otherwise,
disconnected.

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

1. The sum of degrees of all the vertices of a


graph equals twice the number of edges.
2. The number of vertices of odd number
must be even.

Example

Euler’s Theorem 1

1. If a graph has any vertices of odd degree,


then I cannot have a Euler circuit.
2. If a graph is connected and every vertex has
an even degree, then it has at least one
Euler circuit.

Example #1
Fleury’s Algorithm for Finding Eulerian Circuit

Example:

Hamilton Path

- Path that passes through each vertex


exactly once.

Hamilton Circuit

- A circuit that passes through each Complete Graph


vertex exactly once.
A graph Kn with n vertices is said to be a complete
graph if every vertex is adjacent to the other (n-1)
Also known as Traveling Salesman Problem. vertices.
Commonly used in deliveries, to avoid going back
to the same place.

Example:

Note:

Consider a graph K5 (k sub-5). The vertices should


be connected to other vertices to be a complete
graph.

Now, n-1 = 5 – 1 = 4.

Hence, there should be 4 edges connected to each


vertex.
Example: Brute Force Method:

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

- Graph whose edges have assigned


number (weights). Common weights are
time, distance, and cost.
- Complete graphs that are weighted are
called complete weighted graphs.
- Similar to previous example, this also
applies in deliveries to minimize the
cost and time and maximize the profit.

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

- A spanning tree for a connected graph G


of n vertices is a connected subgraph
that is a tree on n vertices. Graph Coloring
- A spanning tree for a graph is a tree that - Function that assigns either the
results from the removal of as many vertices or edges of a graph by a unique
edges as possible from the original color/label.
graph without making it disconnected. - Is specified as either vertex coloring or
edge coloring depending on whether
the vertices or the edges are labelled.

Planar Graph

- A graph is said to be a planar graph if it


can be drawn in a plane w/o the edges
crossing.

Note: If you remove edges without disconnecting -


any vertices. That is spanning tree, You can stretch the edges to become
planar since there are no rules like
geometry that binds them in a certain
position.
Note: Redrawing the edges to become planar is
important in coloring to avoid confusion.

Chromatic Number

- The smallest number of colors needed


to color a graph Is called the chromatic
number.

Four Color Theorem

- Every possible geographical map can be


colored w/ at most four colors in such a
way that no two adjacent regions have
the same color.

Example:
Lesson 5: Linear Programming
- Linear Programming – a mathematical
method in maximizing or minimizing linear
functions subject to set of linear constrain.

- main goal is to create a mathematical


method

- In business production, the objective


function is a linear function that either
maximizes profit or minimizes cost that is Remarks:
subject to a set of linear inequalities called
linear constrains. ➢ The last constraints where x1, x2 ≥ 0 is
called nonnegativity restriction of the
- Linear constrains can be viewed as set of decision variable.
production requirements tat is usually limited ➢ All values of the decision variables that
in quantity. satisfy each linear constraint is called
feasible solution.
Note: Three Components of a Linear
➢ From this feasible solution the objective is
Programming Model
to find the best feasible solution that will
➢ Decision variables that we want to satisfy the objective function called the
determine; optimal solution.
➢ Objective function that we want to
HB. 2
maximize or minimize.
➢ Set of linear constrains that the solution
➢ must satisfy.

HB. 1

Answers (hint):

➢ Decision variables – How many x of the


number of large size and small size
(amount)
➢ Objective function – how did we maximize
the profit
Answers (hint):
➢ Set of linear constrains – max daily
availability in units
➢ Decision variables – How many x of the
number of large size and small size
(amount)
➢ Objective function – how did we minimize
the profit.
➢ Set of linear constrains – (what constraint
did u observed)

Feasible solution for linear inequalities

Solution space or feasible region – it is when both


inequalities are satisfied.

Graphing Method – used to solve the system.

The following steps can be used to solve linear


programming model un two variables.

Step 1. Determine the feasible solution or solution


space of the constraints using solution of system
of linear inequalities in two variables.

Step 2. Determine the corner points of the solution


HB. 3 space by getting the point of intersection of each
pair of lines that defines it.

Step 3. Evaluate the objective functions using the


corner point. The corner point that yields the
optimum value (maximum or minimum) is the
optimal solution of the linear programming model.

Theorem:

In any linear programming model, the optimal


solution (if it exists) can be found in one of the
corner points of the solution space or feasible
region of the constraints.

Remarks: The optimal solutions to the linear


programming problem can be achieved at one
among the corner points.
HB. 1 (continuation)

You might also like