THIS PAGE IS BLANK NEW AGE INTERNATIONAL (P) LIMITED, PUBLISHERS PUBLISHING FOR ONE WORLD New Delhi · Bangalore · Chennai · Cochin · Guwahati · Hyderabad Jalandhar · Kolkata · Lucknow · Mumbai · Ranchi Visit us at www.newagepublishers.com Copyright © 2005, New Age International (P) Ltd., Publishers Published by New Age International (P) Ltd., Publishers All rights reserved No part of this ebook may be reproduced in any form, by photostat, microfilm, xerography, or any other means, or incorporated into any information retrieval system, electronic or mechanical, without the written permission of the publisher All inquiries should be emailed to rights@newagepublishers.com ISBN (10) : 81-224-2304-3 ISBN (13) : 978-81-224-2304-4 PUBLISHING FOR ONE WORLD NEW AGE INTERNATIONAL (P) LIMITED, PUBLISHERS 4835/24, Ansari Road, Daryaganj, New Delhi - 110002 Visit us at www.newagepublishers.com THIS PAGE IS BLANK # Fundamental Approach to Discrete Mathematics Example algorithm For the following travelling salesman problem, carry out the closest insertion Solution : Given that the complete weighted graph G as Choose the vertex v1 Choose the vertex v2, which is closest to v1 So, w2 = v1 v2 v1 Choose the vertex v 3, which is close to w2 So, w3 = v v2 v3 v1 Choose the vertex v4, which is close to w3 Hence, we have the following cases w4 = v1 v2 v3 v4 v1 or = v1 v v4 v3 v1 or = v1 v4 v2 v3 v Now length of v1 v2 v3 v4 v1 = 10 + 40 + 30 + 20 = 100 Length of v1 v2 v4 v3 v1 = 10 + 45 + 30 + 15 = 100 Length of v1 v4 v2 v3 v1 = 20 + 45 + 40 + 15 = 120 Therefore, w4 = v1 v2 v3 v4 v1 is minimum Choose the vertex v5, which is close to w4 Hence, we have the following cases The length of following cycles is given as below v1 v2 v3 v4 v5 v1 = 10 + 40 + 30 + 55 + 25 = 160 v1 v2 v3 v5 v4 v1 = 10 + 40 + 35 + 55 + 20 = 160 v1 v2 v5 v3 v4 v1 = 10 + 50 + 35 + 30 + 20 = 145 v1 v5 v2 v3 v4 v1 = 25 + 50 + 40 + 30 + 20 = 165 As all the vertices are included in the cycle, so the process terminates Hence , the shortest Hamiltonian cycle is given as v1 v2 v5 v v4 v1 Tree # Example For the travelling salesman problem given in example 4, carry out the two optimal algorithm Solution : For the complete weighted graph G given above, the number of vertices (n) = According to the two optimal algorithm we have the following steps Let C = v1, v2, v3, v4, v5, v1 be a Hamiltonian cycle Therefore, we get w = w(v1v2) + w(v2v3) + w(v3v4) + w(v4v5) + w(v5v1) = 10 + 40 + 30 + 55 + 25 = 160 Set i = Set j = i + = Set Cij = C13 = v1 v3 v2 v4 v5 v1 w13 = w w(v1v2) w(v3v4) + w(v1v3) + w(v2v4) = 160 10 30 + 15 + 45 = 180 As w13