MATM-FINALS-2

You might also like

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

MATM

CODING THEORY

CODING THEORY - is the study of the properties of codes and their respective fitness for specific applications. Codes
are used for data compression, cryptography, error detection, correction, data transmission and data storage.
CODES - are studied by various scientific disciplines, such as information theory, electrical engineering, mathematics,
linguistics, and computer science—for the purpose of designing efficient and reliable data transmission methods.
Four types of coding
1) DATA COMPRESSION (or source coding)
2) ERROR CONTROL (or channel coding)
3) CRYPTOGRAPHIC CODING
4) LINE CODING
> This typically involves the removal of redundancy and the correction or detection of errors in the transmitted data.

> The communication system composed of sender (or message source), communication channel, and the receiver.
COMMUNICATION CHANNEL - Is the physical medium through which information is transmitted. Ex: telephone lines,
internet cables, fiber-optic lines, and air. Some storage data can be considered channels (CD-ROMS, hard drives).
NOISES - It alters the message in the channel that will cause disruption and error in the messages.
SOURCE CODING AND CHANNEL CODING - In transmitting messages, coding is defined as source coding and
channel coding.

TWO PROCESSES IN CODING


1. ENCODING - is transforming messages into bits of message that are suitable in communication.
2. DECODING - is the opposite process of encoding.

DATA COMPRESSION OR SOURCE ENCODING is defined as converting the message from the sender into bits
suitable to the communication channel.
BIT - (short for "binary digit") is the smallest unit of measurement used to quantify computer data. It contains a
single binary value of 0 or 1.
ASCII (AMERICAN STANDARD CODE) - converts each character in the message to a byte of 8 bits. Eg. of bit.
> In most computer systems, a byte is a unit of data that is eight binary digits long. A byte is the unit most computers
use to represent a character such as a letter, number or typographic symbol.
> ex: Consider the source encoding of four directions as follows:
NORTH - 00 EAST - 10
SOUTH - 01 WEST - 11
> Suppose the message “NORTH”, which is encoded as 00, is transmitted over a noisy channel. The message may
encounter errors and may be received as 01. The receiver will get the message 01 and decode it as “SOUTH” without
realizing that the message is corrupted.
> With this problem at hand, an additional process of encoding is required known as Channel Coding.

CHANNEL CODING - adding some form of redundancy to the source encoded message so that the errors can be
detected or even corrected.
PARITY CHECK
> also called as “Vertical Redundancy Check (VRC)”
> Where a single bit is added to the message as a redundancy bit.
> A bit string is said to have an odd parity if there is an odd number of
1s.
> Even parity if there is an even number of 1s. We add a redundancy bit
to the message such that it will become an even parity.
> Two types: odd parity and even parity
ODD PARITY - If the data has an even number of 1’s, the parity bit is 0. Odd number of 1’s, the parity bit is 1.
Ex: data is 10010001 -> parity bit 1
EVEN PARITY - If the data has an odd number of 1’s, the parity bit is 0. Even number of 1’s, the parity bit is 1.
Ex: data is 10010101 -> parity bit 1
REPETITION CODE: ENCODING
> In coding theory, the repetition code is one of the most basic error-correcting codes.
> In order to transmit a message over a noisy channel that may corrupt the transmission in a few places, the idea of
the repetition code is to just repeat the message several times.
> Suppose that the source encoding is already done and that the encoded message is of fixed length k. The channel
encoding by repetition is performed by taking the k bits then repeating it 2r + 1, where r is greater than or equal to 1
is a fixed integer.
Ex: Suppose that the source encoded message is 110 where k=3. If you choose r= 2 , the message must be repeated 2r
+1 = 2(2) + 1 or 5 times. This will result to 110110110110110
REPETITION CODE: DECODING
Example: Assume that the message is transmitted through a noisy channel and distorted. The received message is
111001101110010 .The channel encoding uses repetition code where k= 3. Decode the received message.
Solution: 111 001 101 110 010

MODULAR ARITHMETIC

> Is a system of arithmetic for integers, which considers the remainder.


> In modular arithmetic, numbers "wrap around" upon reaching a given fixed quantity (this given quantity is known as
the modulus) to leave a remainder.
> Modular arithmetic is often tied to prime numbers, for instance, in Wilson's theorem, Lucas's theorem, and Hensel's
lemma, and generally appears in fields like cryptography, computer science, and computer algebra.
CONGRUENCE
> Let a and b are integers and m is a natural counting number. a IS CONGRUENT TO b MODULO m” a ≡ b (mod m), IF
m DIVIDES a - b OR b - a. Example: Verify if the congruence is true 4 ≡ 9(mod 2) = FALSE
1. 3 ≡ 9 (mod 2) It is true since 9 – 3 = 6, which is divisible by 2.
2. 4 ≡ 15 (mod 3) It is false since 15 – 4 = 11, which is divisible by 3.
3. 7 ≡ 15 (mod 4) It is true since 15 – 7 = 8, which is divisible by 4.
4. 5 ≡ 20 (mod 3) It is true since 20 – 5 = 15, which is divisible by 3.
5. 4 ≡ 20 (mod 3) It is false since 20 – 4 = 16, which is divisible by 3.
LAST RESIDUE
> To determine the least residue is to simply get the remainder when b is divided by m.
> b(mod m) means b divided by m. m is referred to as the modulus (divisor). Least Residue To determine the least
residue is to simply get the remainder when b is divided by m.
> Find the least residue, r r = 54 (mod 7) = 5
1. 29 (mod 3) = Answer is 2, since 2 is the remainder of 29/3.
2. 35 (mod 4) = Answer is 3, since 3 is the remainder of 35/4.
3. 50 (mod 7) = Answer is 1, since 1 is the remainder of 50/7.
4. 30 (mod 4) = Answer is 2, since 2 is the remainder of 30/4.
5. 25 (mod 5) = Answer is 0, since there is no remainder of 25/5.

OPERATIONS IN MODULAR ARITHMETIC


> addition : (a+b) mod m
> subtraction : (a-b) mod m
> multiplication : (a*b) mod m
> division : (a/b) mod m
1. 10 - 4 (mod 5) = 1
2. 11 + 7 (mod 3) = 0
3. 8 + 7 (mod 7) = 1
4. 20 - 7 (mod 5) = 3
5. 31 - 6 (mod 4) = 1

CHECK CODES AND CHECK DIGITS

> There are several methods in producing identification numbers which are unique.
> In the following methods, modular arithmetic is used to produce and verify identification numbers.
Examples:
> the Universal Product Code (UPC), United States Postal Services (USPS), the Credit Card, and the International
Standard Book Number (ISBN).
> Each example uses their last digit as the check digits to verify the identification number.
UNIVERSAL PRODUCT CODE (UPC)
> is mainly used in products sold in department stores and groceries. The UPC consists of barcodes with 12 digits
where the last one is the check digit.
INTERNATIONAL STANDARD BOOK NUMBER (ISBN)
> is used on books where usually found at the last page of the book. ISBN can be ISBN-10 or ISBN-13 where they used
10 digits or 13 digits string of numbers respectively with the last digit as the check digit.

UNITED STATES POSTAL SERVICES (USPS)


> consists of 11 digits, while the Credit Card uses 16 digits where both of them uses their last digits as the check
digits.

FORMULAS FOR THE CHECK DIGITS


(ADD ALL THE DIGITS, TREATING THE TWO-DIGIT NUMBERS AS TWO SINGLE DIGITS. )
UNIVERSAL PRODUCT CODE (UPC)
d12 d12 = 10 – (3d1 +d2 + 3d3 + d4 +3d5 +d6 + 3d7 + d8 + 3d9 + d10 + 3d11)(mod10)
INTERNATIONAL STANDARD BOOK NUMBER (9 ISBN-10)
d10 d10 = 11 - (10d1 + 9d2 + 8d3 + 7d4 + 6d5 + 5d6 + 4d7 +3d8 +2d9 )(mod 11)
INTERNATIONAL STANDARD BOOK NUMBER (ISBN-13)
d13 d13 = 10 – (d1 + 3d2 + d3 + 3d4 + d5 + 3d6 + d7 +3d8 + d9 + 3d10 + d11 + 3d12 )(mod10)
UNITED STATES POSTAL SERVICES (USPS)
d11 d11 = 9 – (d1 +d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 )(mod 9)
CREDIT CARD
d16 d16 = 10 – (2d1 +d2 +2d3 +d4 +2d5 +d6 +2d7 +d8 +2d9 +d10 +2d11 +d12 +2d13 +d14 +2d15 )(mod10)
EXAMPLE 1: Determine the check digit for a new product if the first 11 digits are 8-21345- 67132.
SOLUTION: Let d1 = 8, d2 =2, d3 =1, d4 = 3, d5 =4, d6 = 5, d7 = 6, d8 =7, d9 = 1, d10 =3, d11 = 2
ANS: d12= 10 – (3d1 +d2 + 3d3 + d4 +3d5 +d6 + 3d7 + d8 + 3d9 + d10 + 3d11)(mod10)

EXAMPLE 2 Determine the check digit for USPS if the first 10 digits are 12-2133-1321.
SOLUTION: Let d1 =1, d2 =2, d3 =2, d4 = 1, d5 =3, d6 = 3, d7 = 1, d8 =3, d9 = 2, d10 =1
ANS: d11 = 9 – (d1 +d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 )(mod 9)

EXAMPLE 3 Verify if the given Credit Card identification number 4301-1234-8888-3751 is valid.
SOLUTION: Let d1 = 4, d2 = 3, d3 = 0, d4 = 1, d5 = 1, d6 = 2, d7 = 3, d8 = 4, d9 = 8, d10 = 8, d11 = 8, d12 = 8, d13 = 3,
d14 = 7, and d15 = 5.
ANS: d16 = 10 – (2d1 +d2 +2d3 +d4 +2d5 +d6 +2d7 +d8 +2d9 +d10 +2d11 +d12 +2d13 +d14 +2d15 )(mod10)

CRYPTOGRAPHY

> It is a science of protecting information by encoding it into unreadable format.


> Originated from two Greek words such as “KRYPTO” (hidden) and “GRAPHENE” (writing)
> It is a method of making and breaking of secret codes.
> a science of encrypting and decrypting written communication.

ENCRYPTION - is the process of transforming plain text into code form using a certain algorithm.
DECRYPTION - the process of returning/converting back the coded message into plain text.
PLAIN TEXT - refers to the original text.
CIPHER TEXT - refers to the coded text.
KEY - refers to the strings of information that are used to reveal the encrypted message into readable form.

SIMPLE METHODS
SHIFT CIPHER (CAESAR CIPHER)
> it is the simple type of substitution cipher.
> it uses shifts in forming the key of cryptography.
ABCDEFGHIJKLMNOPQRSTUVWXYZ

USING SHIFT 3 TO THE LEFT


ABCDEFGHIJKLM
DEFGHIJKLMNOP
NOPQRSTUVWXYZ
QRSTUVWYZABC
Ex: USING SHIFT 3 TO THE LEFT, ENCRYPT THE WORD “CRYPTOGRAPHY” - FUBSWRJUDSKB

USING SHIFT 5 TO THE RIGHT


ABCDEFGHIJKLM
VWXYZABCDEFGH
N O P Q R S T U V WX Y Z
IJKLMNOPQRSTU
Ex: USING SHIFT 5 TO THE RIGHT, DECRYPT THE CIPHER TEXT “BJY DN BJJY” - GOD IS GOOD

MODULO OPERATOR - the sender of the uses the key K to encrypt and to decrypt the secret message.
1. express the letters of the alphabet from 0-25
2. calculate Y=(C+K) mod 26
3. convert the number Y into a letter following the order of the letter of the alphabet

Ex: Encrypt the message “MMW is fun to learn” let k = 5 - 12 12 22 8 18 5 20 13 19 14 11 4 0 17 13

Y = (17 17 27 13 23 10 25 18 24 19 16 9 5 22 18) mod26


Y = (17 17 1 13 23 10 25 18 24 19 16 9 5 22 18)
17 17 1 13 23 10 25 18 24 19 16 9 5 22 18
RRBNXKZSYTQJFWS
Decrypt in modulo operator
1. express the letters of the alphabet from 0-25
2. calculate C=(Y-K) mod 26
3. convert the number C into a letter following the order of the letter of the alphabet

RRBNXKZSYTQJFWS
17 17 1 13 23 10 25 18 24 19 16 9 5 22 18

Y = (12 12 -4 8 18 5 20 13 19 14 11 4 0 17 13) mod26


Y = (12 12 22 8 18 5 20 13 19 14 11 4 0 17 13)
APPORTIONMENT

> the equal proportion


> Is a method of dividing a whole into various parts.
> It means that the number of representatives (the seat) is proportional to the population size being represented.

HAMILTON PLAN
> Standard divisor (D) – the number of voters represented by each representative.
𝐷 = 𝑛𝑜. 𝑜𝑓 𝑟𝑒𝑝𝑟𝑒𝑠𝑒𝑛𝑡𝑎𝑡𝑖𝑣𝑒𝑠 = 𝑅
𝑡𝑜𝑡𝑎𝑙 𝑝𝑜𝑝𝑢𝑙𝑎𝑡𝑖𝑜𝑛 𝑁

> Standard quota (Q) – the whole part of the quotient when the population of the sub – group is divided by the
standard divisor.
=
𝑠𝑢𝑏−𝑔𝑟𝑜𝑢𝑝 𝑝𝑜𝑝𝑢𝑙𝑎𝑡𝑖𝑜𝑛 𝑁
Q= 𝑆𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝐷𝑖𝑣𝑖𝑠𝑜𝑟 𝐷
> Standard quota , Q must be an integer. In case of decimals, just drop the decimal values .
> When the total standard quota is not equal to the given total apportioned or the number of representatives , place
an additional representative to the next sub – group representative with the highest decimal value until the
representatives are complete.
Example: A new school offering the complete six grades in high school has the following enrollment in the different
grades below. The administration is to apportion the 20 teachers for each grade. Calculate:
a. The standard divisor b. The standard quota
JEFFERSON PLAN
> This method uses a modified standard divisor that arrives at the correct or exact numbers of representatives using
trial and error.
> The modified uses an assumed value always smaller than the standard divisor.
Example: A new school offering the complete six grades in high school has the following enrollment in the different
grades below. The administration is to apportion the 20 teachers for each grade. Use Jefferson Plan Calculate
a. The standard divisor b. The standard quota

APPORTIONMENT PRINCIPLE
> A new representative is added to a sub – group due to an increase in population.
> The representative is assigned to the group in such a way it gives the smallest relative unfairness of apportionment.

Example: RBSN company wants to add a new call center agent in one of its offices. Reports indicate an increase in
the daily calls of the offices in the past month. Determine which office should get the additional agent. Use the
apportionment principle to justify your answer.
HUNTINGTON - HILL APPORTIONED METHOD
> The method that makes use of equal proportion.
> The new additional representative to a sub – group must have the highest Huntington number.

Example: RBSN company wants to add a new call center agent in one of its office. Report indicate an increase in the
daily calls of the offices in the past month. Determine which office should get the additional agent. Use the
Huntington –Hill apportionment to justify your answer.
VOTING

> Voting is a powerful tool in decision making. It is a method that uses votes to determine the winner.

MAJORITY VOTING - Majority Vote: over 50 % of the people voting must vote for the candidate.
PLURALITY METHOD - Each voter votes for one candidate, and the candidate with the most votes wins. In-case of
ties, voting should be done using the run-off election.
Example of majority and plurality voting:

BORDA COUNT METHOD - Award points to candidates based on preference schedule, then declare the winner to be
the candidate with the most points.

> In general, if N Is the number of candidates...


✓ Each first-place vote is worth N points.
✓ Each second-place vote is worth N –1 points.
✓ Each third-place vote is worth N –2 points.
✓ Each Nth-place (i.e., last place) vote is worth 1 point.
Example: A corporation would like to invite a new investor. The possibilities are Ayala (A), Bonifacio (B), Calixto (C),
and Dancel (D). Who is the winner under the Borda Count?

PLURALITY BY ELIMINATION
> The plurality with elimination voting method is also known as an instant run-off voting and sequential run-off voting.
> It is a preferential voting method and candidates that have the least first place votes get eliminated until one
candidate has a majority of first place votes.

A = 5+2+4 = 11
B = 6 + 3 =9
The winner is candidate A
PAIRWISE COMPARISON VOTING
> Compare each two candidates head-to-head.
> Award each candidate one point for each head-to-head victory.
> The candidate with the most points wins.
GRAPH THEORY

GRAPH - A diagram that contains information and depicts connection and relationship between the various parts of
the diagram.
Ex: road map, circuit diagram, flow chart, transportation route, tree diagram
Essential features of a graph:
1.) The Objects – referred to as the nodes or vertices
2.) Edges – the connecting line

From example 3;
> Edge e4 is known as Loop. Loop is an edge that connects a
vertex to itself.
> Edges e7 and e8 are called multiple edges or parallel
edges. Parallel Edges – are edges that connect the same
vertices.

PATH - A path in graph theory is a sequence of edges.


G1 Paths Length
1.) ade 3
2.) adc 3
3.) bce 3
4.) abced 5
5.) adecb 5

> A path can repeat edges.


> The length of a path refers to the number of edges connected.
> If the direction is not indicated in the graph by an arrow, the movement can be in any direction to find a path (you
can move backward and forward). However if there is an arrow indicating direction the movement in finding a path is
in accordance with the indicated arrow .
G2
Paths Length
1. e4 e3 2
2. e3 e2 e4 3
3. e1 e5 e4 3
4. e1 e5 e4 e3 e2 5
5. e1 e5 e5 e4 4

Vertex Sequence of a Path - a path is written in terms of edges. A path determines a sequence of vertices.
G3
> The number of vertices in the vertex sequence is always one larger
than the number of edges in the path.
> If a path passes through a loop, the vertex of the loop is repeated in
the vertex sequence.

BRIEF HISTORY OF GRAPH THEORY


-From TeroHarju Lecture Note
Graph theory may be said to have its beginning in 1736 when EULER considered the (general case of the) Königsberg
bridge problem: Does there exist a walk crossing each of the seven bridges of Königsberg exactly once? (Solution
Problema tisadgeometriamsituspertinentis,CommentariiAcademiaeScientiarumImpe rialisPetropolitanae 8 (1736),
pp.128-140.) It took 200 years before the first book on graph theory was written. This was
“TheoriederendlichenundunendlichenGraphen '' (Teubner,Leipzig,1936) by KÖNIG in 1936. Since then graph theory has
developed into an extensive and popular branch of mathematics, which has been applied to many problems in
mathematics, computer science, and other scientific and not- so- scientific areas. For the history of early graph
theory, see N.L. BIGGS, R.J. LLOYD AND R.J. WILSON, “Graph Theory 1736 – 1936”, Clarendon Press, 1986.-
CLOSED PATH - said to be a closed path if the first and the last vertices of its vertex sequence are the same.
G4

CYCLE - a path is called a cycle if the following conditions are satisfied:


a.) the path is closed
b.) the path repeat no edges
c.) the vertices of the vertex sequence of the path are all distinct except for the 1st and last vertices which are the
same vertices.

G5

CONNECTED GRAPH - called a connected graph if for any two given vertices there is a path connecting them.

NOT CONNECTED CONNECTED CONNECTED


COMPLETE GRAPH - is a connected graph where every pair of vertices is joined by an edge.

SIMPLE GRAPH - it has neither loop nor parallel edges.

Simple graph not simple not simple

DEGREE OF VERTEX - the number of edges connected to the vertex. If a graph contains a loop, the loop contributes 2
to the degree of the vertex.

ACYCLIC GRAPH - has no cycle

Acyclic cycle: CDHG -wsrv / Not acyclic


WEIGHTED GRAPH - whose edges are assigned with weights. Weight may represent mileage, time, cost, or some
other quantities. Consider the transportation route of a salesman;

The vertices correspond to the different


cities while edges represent the distances
in kilometers.

TREE - An acyclic connected graph. Properties: acyclic graph, no cycle path, connected graph. Forest refers to
several trees.

SPANNING TREE - a sub-graph tree of a graph that contains all the vertices of the graph.

If a graph has an n-edges then there


are n! Spanning tree in the graph
MINIMAL SPANNING TREE - a spanning tree of the graph with a minimum total weights. a connected graph has
always at least one minimal spanning tree.

> G14.1 is the minimal spanning tree of G14,i.e., 5+8+10 (23 total weights)

TWO SPECIAL CIRCUIT - A closed path in a graph which uses each of the edges exactly once. Named after Leonard
Euler(April 15, 1707 –September 18, 1783), a Swiss Mathematician and Physicist. He started working on graphs from
the year 1736.
Euler Theorem: The graph has an Euler Circuit if the graph is connected and the degree of the vertices must be even.
Euler Path: a path that uses each edge of a graph exactly once.
Euler Path Theorem: a connected graph has an Euler path if and only if the graph has two vertices of odd degree
with all other vertices of even degree.
> By Euler Theorem, the graph contains vertices having an odd degree; the graph has no Euler Circuit. There is no
closed path that will bring us to each island by crossing each bridge exactly once. Therefore, the Konigsberg Bridge
problem has no solution.

FLEURY’S ALGORITHM - used to find an Euler Circuit in a graph if the graph has one.
Steps:
1. Select any of the vertices in the graph as the starting point.
2. Select any edge connected to the vertex selected in step 1. Remove the edge. (The removal of the edge must not
disconnect the starting vertex or the starting point). After the removal of the edge a new vertex is reached.
3. Select an edge connected to the new vertex and repeat step 2.
4. Repeat step 3 until the starting vertex is reached.

> Therefore, the Euler Circuit is-fdecba (with a vertex sequence: XYZZWYX)
HAMILTON CIRCUIT
> A closed path which uses each vertex of the graph exactly once, except for the last vertex which duplicates the 1st
vertex. Also known as the Hamiltonian Circuit.
> Named after Sir William Rowan Hamilton (1805-1865) He marketed a puzzle in the mid 1800 in the form of a
dodecahedron that contains the name of a city in each corner. The problem is to visit each city exactly once by
traveling along the edges and be able to return to the starting city. (D.S. Malik and M.K. Sen).

DIRAC’S THEOREM - Consider a connected graph with at least 3 vertices and no multiple edges. Let n be the number
of vertices in the graph. If every vertex has degree of at least n/2, then the graph must be HAMILTONIAN.

Algorithm used to find a Hamiltonian Circuit


Greedy Algorithm - Also known as shortest path algorithm
Steps:
1. Choose a vertex to start at, then travel along the connected edge that has the smallest weight.( if two or more
vertices 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 until you have visited all vertices.
3. Return to the starting vertex.

The Hamilton Circuit is now completed, with a vertex


sequence: C1C2C4C7C8C5C6C3C1

total weight : 80+90+160+110+105+60+200+90=835.


THE EDGE-PICKING ALGORITHM
Steps:
1. Mark the edge of the smallest weight in the graph.(if two or more edges have the same weight, pick only one)
2. Mark the edge of the next smallest weight in the graph, as long as it does not complete a circuit and does not add a
third marked edge to a single vertex.
3. Continue this process until you can no longer mark any edges. Then mark the final edge that completes the
Hamiltonian circuit.

PLANAR GRAPH - can be drawn so that no edge intersects each other (except at vertices)

> G20.2 is NOT a planar graph


since it cannot be re-drawn
(G20.3) without any intersecting
edges.

MATRIX REPRESENTATION OF A GRAPH


Rule: If a graph has N vertices its matrix representation has NxN shape, denoted by M.

> The entries indicate the edges between the vertices.


M(W,X) = 2 means that there are 2 edges that connect W & X. M(X,Y) = 0
means that there is no edge that connects X & Y.
> The diagonal indicates the loop/s in the graphs.
M(Z,Z) =2 means that there is a loop that is connected to vertex Z
> The degree of the vertex is equal to the sum of the entries in its row or
column. Deg(W) = 4 (sum of its column entry or of its row entries)
> The matrix is symmetric with respect to its diagonal.
ADJACENCY MATRIX OF SIMPLE GRAPH - Theorem: If M is the adjacency of a simple graph, then the row* column
entry of Mn is equal to the number of length n from vertex from row to the vertex in column, n=1,2,3…

How many paths of length 2 can be used to reach a vertex from


another?

Solution: Path of Length 2 = M2 = MxM The Matrix (M) of the is;

M2 (W,W) = 3, means there are 3 paths of length 2 that connect vertex W to itself. That is; e1e1, e6e6, e4e4.

M2 (X,Z )=2 means there are 2 paths of length 2 that connect vertex x to vertex Z, that is; e1e4 and e2e3. Since the
Matrix is symmetric, we can consider the upper diagonal or the lower diagonal. Therefore the total number of paths of
length is 3+3+3+3+2+2+2+2+2+2 =24 paths.

Note: Paths of length 3 are M3 of length 4 is M4 .


THEORY THE PIPELINE PROBLEM

The MAYNILAD is considering 8 cities to be connected by a pipeline. The distances (in km) between cities are given in
the graph below:

Determine the minimum length of pipe that MAYNILAD is needed to connect the 8 cities. Use the minimal spanning
tree.

Total weight of the minimal spanning tree = 80 + 90+ 80+150 +60+70+105 = 635
Therefore, Maynilad needs a 635 km length of pipeline to connect the 8 cities.

THE MAP COLORING PROBLEM

The Four Color Theorem - Every map in the plane consisting of connected regions without a hole can be colored with
four different colors without coloring two adjacent regions with the same color.
Example: Consider the Map that shows some of the states of the US.

How should the map be colored with 4 colors if no two


adjacent states should have the same color?

Solution: Draw the graph representation of the map.


a.) Vertices are the regions or states
b.) Edges – to connect two vertices if the states or regions
corresponding to these vertices are adjacent.
Use 4 colors to be assigned to its vertices.
Assigned 2 different colors to any 2 adjacent
vertices.

TRAVELING SALESMAN PROBLEM (Hamiltonian Problem)

Example: In 1859, Sir William Rowan Hamilton marketed a game called Around the World. The game consisted of a
regular dodecahedron made of wood. Each corner bore the name of a famous city of the world. The game was to find a
path starting at any city, traveling along the edges of the dodecahedron, visiting each city exactly once and returning
to the starting city. The diagram below represents the game. (Source: D.S. Malik and M.K. Sen)

Solution: Using the Hamiltonian Circuit:

Therefore, one of the Hamiltonian


Circuit that can be an answer to the
puzzle is the path with vertex
sequence of:

V1V2V3V4V5V14V13V12V11V10V9V8V7V17V18V19V20V16V15V6V1

You might also like