Republic of the Philippines SORSOGON STATE UNIVERSITY Baribag Campus ENGINEERING AND ARCHITECTURE DEPARTMENT Worksheet #20 Mathematics of Graph 1 Name: Kecy H. Guevara Term: 1st Semester, 2021-2022 Course/Year: BSEE – 1A Score: _____ Instructor: Engr. Noel G. Benavides, Ph.D. 1. Use the greedy algorithm to find a Hamiltonian circuit starting at vertex A in the weighted graph shown below. A 8 9 5 E 6 B 5 5 8 7 D 3 4 C The Hamiltonian circuit is: A-E-B-D-C-A The total weight is: 28 2. Use the edge-picking algorithm to find a Hamiltonian circuit in the weighted graph in problem 1. A 9 8 5 6 E B 5 5 8 7 D 3 4 C AB=8 AC=9 AD=6 AE=5 BC=3 BD=5 BE=5 CD=4 CE=7 DE=8 The Hamiltonian circuit is: A-E-B-D-C-A. The total weight is: 5+5+5+4+9= 28 3. Businesses often network their various computers. One option is to run cables from a central hub to each computer individually; another is to connect one computer to the next, and that one to the next, and so on until you return to the first computer. Thus the computers are all connected in a large loop. Suppose a company wishes to use the latter method, and the lengths of cable (in feet) required between computers are given in the table below. Computer A Computer B Computer C Computer D Computer E Computer F Computer G Computer A ----43 25 6 28 30 45 Computer B 43 ----26 40 37 22 25 Computer C 25 26 ----20 52 8 50 Computer D 6 40 20 ----30 24 45 Computer E 28 37 52 30 ----49 20 Computer F 30 22 8 24 49 -----41 Computer G 45 25 50 45 20 41 ------ Use both of the algorithms to determine how the computers should be networked if the business wishes to use the smallest amount of cable possible. Solution: Graph A G 45 43 B 25 30 41 22 20 F 25 28 6 50 40 8 45 37 26 C 52 49 20 24 E 30 D GREEDY ALGORITHM: A G 45 43 B 25 30 41 25 22 20 F 28 6 50 40 8 45 37 26 C 52 49 20 24 30 E D Greedy Algorithm: The Hamiltonian circuit is: C-F-B-G-E-A-D-C The total weight is: 8+22+25+20+28+6+20 = 129 FT EDGE-PICKING ALGORITHM: AB= 43 BC= 26 CD= 20 DE= 30 EF= 49 AC= 25 AD= 6 BD= 40 BE= 37 CE= 52 CF= 8 DF= 24 DG= 45 EG= 20 AE= 28 BF= 22 CG= 50 AF= 30 BG= 25 AG= 45 FG= 41 A G 45 43 B 25 30 41 22 20 F 25 28 6 50 40 8 45 37 26 C 52 49 20 24 E Edge-Picking Algorithm: The Hamiltonian circuit is: A-D-C-F-B-G-E-A The total weight is: 6+20+8+22+25+20+28= 129 FT 30 D