517 views

The Travelling Salesman Problem is a traditional algorithm used to find the shortest or least path.This problem is mostly utilized in computer science to deliver packets from source to destination as there are lots of routes present in a network. This number of routes can cause congestion, delay or data loss, so utilizing Travelling Salesman Problem to find the shortest path from sender to receiver is an efficient way to transmit data with less congestion and also in less time. It is generally used to find the optimum solution for a complex network. The Travelling Salesman Problem can be solved using meta-heuristic approaches such as Ant colony optimization or genetic algorithm, however the easiest approach to solve the Travelling Salesman Problem is Nearest Neighbor Algorithm. The optimum solution of Travelling Salesman will save time and travelling expenses of a salesman. In Travelling Salesman problem, the main aim is to visit each city in a network once following the shortest path and return to the starting position.

- Final Report - Solving Traveling Salesman Problem by Dynamic Programming Approach in Java Program Aditya Nugroho Ht083276e
- RA3902A06
- Networking
- MID Term Info Sec
- Algorith Analysis - TSP with backtracking
- Srs
- Zahir i 2014
- The Inventory Routingproblemwithtransshipment
- Sea2011 Yang
- Compressing Straw 2
- GA_fodfg
- A Heuristic Algorithm for The Traveling-Salesman Problem for a Double Integrator
- 10.1.1.19
- Improved Harmony
- 1-s2.0-S004579490900008X-main.pdf
- Main Greedy Mid Sem 2011
- presentation quantisation.doc
- DE-GA based Model for Load Balancing in Cloud Computing
- Adaptive Control
- Ch 9 Network

You are on page 1of 4

Nearest Neighbor Algorithm

1,2

Department of Electronics and communication Engineering

1,2

SSGI FET Bhilai, India

algorithm used to find the shortest or least path.This problem

is mostly utilized in computer science to deliver packets from

source to destination as there are lots of routes present in a

network. This number of routes can cause congestion, delay

or data loss, so utilizing Travelling Salesman Problem to find

the shortest path from sender to receiver is an efficient way

to transmit data with less congestion and also in less time. It

is generally used to find the optimum solution for a complex

network. The Travelling Salesman Problem can be solved

using meta-heuristic approaches such as Ant colony

optimization or genetic algorithm, however the easiest

approach to solve the Travelling Salesman Problem is

Nearest Neighbor Algorithm. The optimum solution of

Travelling Salesman will save time and travelling expenses

of a salesman. In Travelling Salesman problem, the main aim

is to visit each city in a network once following the shortest

path and return to the starting position.

Key words: Travelling salesman problem, meta-heuristic,

congestion, optimum, Nearest Neighbor algorithm

I. INTRODUCTION

The Travelling salesman problem is a traditional algorithm

which is used to find the optimal solution. The main aim the

Travelling Salesman problem is to visit all the cities once and

return to the position from where it has started its journey.

One of the main concern here in Travelling salesman problem

is that the salesman cannot move to the same city twice, else

the condition of Travelling Salesman is violated. The

sequence in which the salesman moves and visit each city is

not any concern, as the salesman can move and follow any

order to visit each city. In Fig.1 the distance between each

city is shown which a salesman has to spend on moving to

the next city. It must be clear that the distance is taken in

terms of roadways. The salesman has to maintain the distance

as small as possible to reduce the expenses and time. In any

network, data transmission from sender to receiver must be

properly done. Transmitting data from sender to receiver,

proper routing must be done by the router. The router routes

the data through a proper path to avoid congestion and data

loss, however it is not easy to route a data if there is a complex

path or too many nodes in between the sender and receiver,

here the Travelling Salesman problem is very much useful.

The Travelling Salesman problem will help in determining

the shortest and simplest path between the sender and

receiver. This will also help in minimizing the congestion,

delay and also data loss.

their distance is shown.

In Fig.1, distance between each city is depicted and the

salesman has to visit each city in any order finding the

shortest path. The salesman has to find the least path by

ending his journey from the exact position where it has started

its journey. In this paper, we have considered starting point

as a city A, so the salesman has to start and finish his

journey at city A.the Travelling Salesman problem can be

divided into two set on the basis of the organization of the

location of cities (1) Symmetric TSP and (2) Asymmetric

TSP. The arrangement of cities in which the distance between

two cities is same in both directions are considered as a

Symmetric Travelling Salesman problem. The arrangement

of cities in which the distance between two cities is not same

in both directions are considered as an Asymmetric

Travelling salesman problem. In our paper, we have taken an

Asymmetric Travelling Salesman problem only. There are

various algorithms which can be implemented to find the

shortest path for travelling salesmen. Some of them are metaheuristic problems such as ant colony optimization, genetic

algorithm, but in this paper, we have used a Nearest Neighbor

algorithm to find the shortest path for the Travelling

Salesman. It was the first algorithm to find the shortest path

for Travelling salesman problem developed around 1950s.

The idea of this algorithm was given by J. G. Skellam and the

later research work was done by P. J. Clark and F. C. Evans

to find the shortest path.

II. RELATED WORKS

In [1], Fatma a Karkory et al. presented a paper to find the

solution for Travelling salesman problem by using a Nearest

neighbor algorithm as well as minimum spacing tree and

concluded that both of them have equal performance in terms

of the total distance of the journey and time. In [2], Besan A.

AlSalibi et al. implemented a paper in which a comparison

between Nearest neighbor algorithm and genetic algorithm to

find the solution for Travelling salesman problem. In the

856

Determining the Shortest Path for Travelling Salesman Problem using Nearest Neighbor Algorithm

(IJSRD/Vol. 3/Issue 12/2016/223)

is well suited for a small number of cities while Genetic

algorithm was suitable for a large number of cities as well as

a small number of cities. In [3], Mudaliar D.N. et al. presented

a paper in which genetic algorithm is used to find the exact

solution for Travelling salesman problem by performing three

tasks i.e. selection, crossover and mutation. In the paper, a

new crossover operator called m-operator was proposed to

solve the Travelling Salesman problem. In [4], Archit Rastogi

et al. implemented a paper which solves the Travelling

salesman problem using branch and bound method.

III. PROBLEM FORMULATION

In Travelling Salesman problem, to find the shortest path for

M number of cities there are (M-1)! Possibilities i.e. (M-1)!

paths can be obtained. Since for 5 numbers of cities, there

can be 24 various paths, for 6 numbers of cities, there can be

120 paths and similarly for 10 numbers of cities the number

of path increases to 362880 which is huge. If we have to find

the shortest path for 20,30 or 50 cities the number of

possibilities drastically increases to more than millions and

billions which can be very difficult to find the shortest path.

So, the Nearest Neighbor algorithm is suitable for a small

number of cities and for a large number of cities some other

meta-heuristic algorithm like Genetic algorithm must be used

[2]. However, it is very easy to find the shortest path for a

small number of cities using a nearest Neighbor algorithm

rather than other algorithms.

IV. METHODOLOGY

In our paper, we are going to use a Nearest Neighbor

algorithm to determine the shortest path. In Fig.1 five

different cities A, B, C, D, and E are shown by the distance

between each city. The salesman has to start its journey from

the city A visit each city B, C, D, E in any order and then

has to return A again following the shortest path. The

travelling salesman cannot visit the same city again, if it does

so the condition of TSP is violated as shown in Fig.3. An

overview of our approach is given through the flowchart as

shown in Fig.2 however, for better understanding every step

is explained step by step.

Fig.3 below shows the violation of the Travelling salesman

problem. It must be clear that no cities can be visited twice,

even if the salesman has visited all the cities.

A. Step1:

All five cities and the distance between them is shown in

Fig.1 and in this paper, we have assumed that the salesman

will start its journey from city A. The position of a Salesman

is shown by the black box at city A as shown in Fig.1. In

the Nearest Neighbor algorithm, first of all we will observe

the distance between each city which is connected to A and

the salesman will move to that city which is nearest to A.

From Fig.1 it is clear that the distance between A and E

are the shortest so the salesman will move to E instead of

B C and D as shown in Fig.4.

857

Determining the Shortest Path for Travelling Salesman Problem using Nearest Neighbor Algorithm

(IJSRD/Vol. 3/Issue 12/2016/223)

nearest city E

B. Step2:

From Fig.1 it is clear that the distance between E and B

are the shortest so the salesman will move to B instead of

C and D as shown in Fig.5. The salesman now cannot visit

A as it has already visited it earlier.

nearest city B.

C. Step3:

From Fig.1 it is clear that the distance between B and D

are the shortest so the salesman will move to D instead of

C as shown in Fig.6. The salesman now cannot visit A and

E as it has already visited them earlier.

nearest city C.

E. Step5:

From Fig.1 it is clear that the distance between C and A

are the shortest so the salesman will move to A as shown in

Fig.8. The salesman now cannot visit A, B, D and E as

it has already visited them earlier.

nearest city A.

Finally, we have find the shortest path for the Travelling

Salesman problem as shown in Fig.9., the salesman will start

its journey from the city A to E, E to B, B to D, D

to C and finally from C to A. In visiting all those five

cities the salesman covers the shortest distance equal to 35.

In this way, we can find the shortest path using a Nearest

Neighbor algorithm for travelling salesman problem. It is also

a valid solution of the travelling Salesman problem as the

salesman does not visit any city twice and return to the

starting city A from where it has started its journey as

depicted in Fig. 9. For a small number of cities, a Nearest

Neighbor algorithm is very useful and the result can be easily

and quickly obtained, however, for a large number of cities

the Nearest Neighbor algorithm does not effectively work.

nearest city D

D. Step 4:

From Fig.1 it is clear that the distance between D and C

are the shortest so the salesman will move to C as shown in

Fig.7. The salesman now cannot visit A, B, and E as it

has already visited them earlier.

Fig. 9: shows the shortest path for the Travelling salesman

problem in five different cities

858

Determining the Shortest Path for Travelling Salesman Problem using Nearest Neighbor Algorithm

(IJSRD/Vol. 3/Issue 12/2016/223)

V. RESULTS

From above discussions, we have found the shortest path in

20 cities. The location of each city is shown in Fig.10.

Now, using the Nearest Neighbor algorithm we have found

the shortest path and is shown in Fig.11.

Salesman Problem Using Genetic Algorithm

International Journal of Advanced Research in Computer

Science and Software Engineering, Volume 3, pp 376380

[5] Zar Chi Su Su Hlaing and May Aye Khine, Solving

Traveling Salesman Problem by Using Improved Ant

Colony Optimization Algorithm International Journal

of Information and Education Technology, Vol. 1, No. 5,

December 2011, pp 404-409

[6] Gilbert Laporte, The Traveling Salesman Problem: An

overview of exact and approximate algorithm,

European Journal of Operational Research, pp. 231-247

[7] Anshul Singh, Devesh Narayan, A Survey Paper on

Solving Travelling Salesman problem Using Bee colony

optimization, International Journal of Emerging

Technology and Advanced Engineering, Volume 2, Issue

5, May 2012), pp. 309-314

[8] S. Lin, B.W. Kernighan, An effective heuristic algorithm

for the

Travelling salesman problem, Operations

Research 21 (1973), pp.498-516.

[9] D. L. Applegate, R. E. Bixby, V. Chvtal, and W. J.

Cook, The Traveling Salesman Problem: A

Computational Study, Princeton University Press,

2007, pp 2-3.

[10] C. Chauhan, R. Gupta, K. Pathak, Survey of Methods

of Solving TSP along with its Implementation using

Dynamic Programming Approach International Journal

of Computer Applications, vol. 52, no. 4, August 2012.

VI. CONCLUSION AND FUTURE WORK

In this paper, we have found the least path between five and

twenty cities using a Nearest Neighbor algorithm. To find the

shortest path between a small number of cities the Nearest

Neighbor algorithm is suitable and also very simple, but for a

large number of cities the NN algorithm does not provide

appropriate solution. So, we have come into conclusion that

for a small number of cities only the Nearest Neighbor

algorithm is useful. In the future, we will try to find the

solution of The Travelling salesman problem using Genetic

algorithm.

REFERENCES

[1] Fatma A. Karkory, Ali A. Abudalmola, Implementation

of Heuristics for Solving Travelling Salesman Problem

Using Nearest Neighbour and Minimum Spanning Tree

Algorithms Internationa Journal of Mathematical,

Computational, Physical, Electrical and Computer

Engineering Vol:7, pp. 1524-1534 , 2013

[2] Besan A. AlSalibi, Marzieh Babaeian Jelodar and

Ibrahim Venkat, A Comparative Study between the

Nearest Neighbor and Genetic Algorithms: A revisit to

the Traveling Salesman Problem, International Journal

of Computer Science and Electronics Engineering

(IJCSEE) Volume 1, pp. 34-38, (2013)

[3] Archit Rastogi, Ankur Kumar Shrivastava, Nitisha

Payal, A Proposed Solution to Travelling Salesman

Problem using Branch and Bound, International Journal

of Computer Applications Volume 65 No.5, pp. 44-49

March 2013

859

- Final Report - Solving Traveling Salesman Problem by Dynamic Programming Approach in Java Program Aditya Nugroho Ht083276eUploaded byNugroho Aditya
- RA3902A06Uploaded byRichard Tirkey
- NetworkingUploaded byapi-3816734
- MID Term Info SecUploaded bywildnixon
- Algorith Analysis - TSP with backtrackingUploaded byall4downloads
- SrsUploaded byPawan Pandey
- Zahir i 2014Uploaded byVarly Tanawani
- The Inventory RoutingproblemwithtransshipmentUploaded byDaniel Alex Tello G
- Sea2011 YangUploaded byAlluri Appa Rao
- Compressing Straw 2Uploaded byomergevher123
- GA_fodfgUploaded bythedefectedgene
- A Heuristic Algorithm for The Traveling-Salesman Problem for a Double IntegratorUploaded byInternational Journal for Scientific Research and Development - IJSRD
- 10.1.1.19Uploaded byAmr El-Salhy
- Improved HarmonyUploaded byLohit Kumar Sahoo
- 1-s2.0-S004579490900008X-main.pdfUploaded byaybike
- Main Greedy Mid Sem 2011Uploaded byAnkit Chandra
- presentation quantisation.docUploaded byachampet
- DE-GA based Model for Load Balancing in Cloud ComputingUploaded byIJRASETPublications
- Adaptive ControlUploaded byRameez Hayat
- Ch 9 NetworkUploaded bythemoonzone
- Freq Per AgeUploaded bykiresh
- Courses Offered in Foreign Language - Fall 2016Uploaded byRizcha Tasliya Amrullah
- Assignment 1Uploaded byKatneza Katman Mohlala
- Traveling Salesman Problem.pptUploaded byK.R.Raguram
- InPutUploaded byVikesh
- New Health Index Analyses 052013Uploaded byericsson3gpp
- CHEMCIV-19Uploaded byNabil Kazi Tani
- StandardPSO.mUploaded bySutha Sangapillai
- Dissertations and Theses DirectedUploaded bygiri prasad madderla
- Selection.docxUploaded byprinceram123

- Design of Vehicle positioning System Based on ARMUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Data Hiding in Audio-Video using Anti Forensics Technique for AuthenticationUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Sensorless Speed Control of Brushless DC motor Using Back EMF ObserverUploaded byInternational Journal for Scientific Research and Development - IJSRD
- DE Duplication Verification on Multimedia Data Stored in CloudUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Design and Analysis of Flywheel for Weight OptimizationUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Bird Strike Analysis on Single Piece WindshieldUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Synthesis and Characterization of Sisal & Hemp Fiber Reinforced Hybrid CompositesUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Active Vibration Control of Cantilever Beam by using PZT Patches: A ReviewUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Experimental Investigation of Influence of Pipe Elbow on Coefficient of Discharge of VenturimetresUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Analysis of Friction and Lubrication Conditions of Concrete/Formwork InterfacesUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Review of Nature Inspired Technique for Minimize Energy Consumption in Wireless Sensor NetworksUploaded byInternational Journal for Scientific Research and Development - IJSRD
- SVM Based Classification & Remote Detection Of Photoplethysmorgraphic SignalUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Utilization of Glass Powder in Fly Ash BricksUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Grid Connected WECS with Multi-Level NPC Shunt Active Power FilterUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Review on Active Vibration Control of Beam using PZT PatchesUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Authentication and Security Biometrics System based on Face Recognition and Palm RecognitionUploaded byInternational Journal for Scientific Research and Development - IJSRD
- A Review Paper on Optimization of Turning on En31 Material by Taguchi ApproachUploaded byInternational Journal for Scientific Research and Development - IJSRD
- VLSI Implementation of Aging-Aware Reliable Multiplier with Adaptive Hold LogicUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Fuzzy Logic Execution in Boiler ControlUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Seismic Analysis and Design Steel Framed Multi- Storied BuildingUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Seismic Analysis of Multi-Story Building with Underneath Satellite Bus Stop Having Service Soft Story and Moment Transfer BeamsUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Identification of Intra-Cardiac Masses Based on Advanced ACM Segmentation using Multiclass SVM ClassifierUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Study of Thermal Performance of Longitudinal Fin of Rectangular Profile for Different MaterialsUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Background Modeling and Moving Object DetectionUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Grid Connected Solar Photovoltaic System with Converters ControlUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Energy Efficient Input-Output Section for RF ApplicationUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Effect of Rice Husk and Rice Husk Ash on Coconut Fiber Reinforced Polyester CompositesUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Techniques and Technologies for Monitoring Nitrate in Potable Water - A ReviewUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Usage of Static VAR Compensator to Achieve the Voltage Stability During Transmission and DistributionUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Isolation of Phytophthora Palmivora (Butl.) Pathogenic to Papaya plant in Thiruvarur Dt.Uploaded byInternational Journal for Scientific Research and Development - IJSRD

- SSP Procedures ManualUploaded byPaschalis Adhi Rodriguez
- Nokia GSM OptimizationUploaded byambroserf
- Pipe Crossing Ref_00Uploaded byAndi
- 1999 Headshok Fatty Sl Owners Manual Supplement EnUploaded byxjcai
- Activate Kaspersky 2012 License via Key FileUploaded byyurikan2681
- Hot Gas ExpanderUploaded byMary Gomez
- Quick Reference Processing Guidelines- RO4700 Antenna Grade LaminatesUploaded byabdessalem_t
- V DiffractionUploaded byrealzzz1
- 1 1 kt keytermsUploaded byapi-305076964
- AVEVA_Everything3D.pdfUploaded byAriq Rahmatullah Muhammad
- ch2_26_37Uploaded byKeilly Casanova
- B - Parting and GroovingUploaded byedsareg
- Manual WcsUploaded byShinji Ryoichi
- Advanced Microprocessor Course(EC311) Unit 2Uploaded byKvrVigneshRamKrish
- Datasheet Victron SmartSolar-MPPT-150-85-&-150-100-ENUploaded bydafina4275
- 2PU Chemistry QP Model 2013Uploaded byPrasad C M
- Labsa Flow ChartUploaded byPUSHKARKHANNA
- Ac 25.1353-1a - Electrical Equipment and InstallationsUploaded byKaung MyatToe
- Chapter-3Uploaded byhenybam
- RO Systems Operationc - Best Practice GuidelinesUploaded byNguyen Van Dzung
- RVI.pdfUploaded bymed4jonok
- Potsdam Village Police Dept. blotter June 16, 2018Uploaded byNewzjunky
- Www.aquileiaforum.orgUploaded bydonnal47
- Bargain & Used Parts Stock 20161209 0Uploaded byageng sakoko
- Dynamic ProgrammingUploaded bykirsh123
- _SQL1 (2)Uploaded byPrashant Saxena
- iPhoneOSABIReferenceUploaded byUdayakanth Sripada
- Cutting LubricantsUploaded byMetalloy
- psoc quizUploaded byKuldeep Singh
- 07-TransformCodingUploaded byaishwarya