shortest path between two nodes on a potential railway system in cyprus
DESCRIPTION
Finding and calculating the shortest way to get from one location to another on a Cyprus railway map.TRANSCRIPT
Shortest Path Between Two Nodes on a Potential Railway System In Cyprus
Mr. Erdogan Kaygan(European University of Lefke)
2
CONTENTS
– Introduction– Aim Of The Project– Graph Theory– Dijkstra Algorithm – How The System Works( Software)– Conclusion– References
Introduction
•Most common problem in computer science.Most common problem in computer science.
•Shortest path problem is the problem of finding a path between two Shortest path problem is the problem of finding a path between two vertices.vertices.
•Aim of the projectAim of the project: Finding and calculating the shortest way to get : Finding and calculating the shortest way to get from one location to another on a Cyprus railway map.from one location to another on a Cyprus railway map.
3
Graph Theory
•Directed Graph Directed Graph Directed graph defined as G = (V,E)Directed graph defined as G = (V,E)
wherewhere;;
V: a set of vertices and V: a set of vertices and
E: a set of edges E: a set of edges
4
V1 V2
V3
E1
E2E3
Figure1 Directed Graph
Graph Theory
•Adjacent ListAdjacent List EEach vertex has a list of which vertices it is adjacent toach vertex has a list of which vertices it is adjacent to.. Example:Example:
5
V1 V2
V3
E1
E2E3
Vertices Adjacent List
V1 V2, V3
V2 V1, V3
V3 V1, V2Figure2 Directed Graph
Table1. Adjacent List
Dijkstra Algorithm
• Designed to find the shortest path between two nodes.Designed to find the shortest path between two nodes.
•Algorithm stepsAlgorithm steps
1)1) Select current node 0Select current node 0Set the value of all other nodesSet the value of all other nodesto infinity.to infinity.Mark nodes unvisitedMark nodes unvisited
6
10
3
58
72
Girne
Guzelyurt Lefkosa
Akdogan
Gazimagosa
Dijkstra Algorithm
2) Update new value for visited node2) Update new value for visited nodeCheck the smallest.Check the smallest.
Girne-Guzelyurt: 10 Girne-Guzelyurt: 10 Girne-Lefkosa: 5Girne-Lefkosa: 5Girne-Gazimagosa: 8Girne-Gazimagosa: 8
7
10
3
58
72
Girne
Guzelyurt Lefkosa
Akdogan
Gazimagosa
10 5 8
Dijkstra Algorithm
3) For each unvisited nodes (Akdogan )3) For each unvisited nodes (Akdogan )update the values. update the values.
Girne-Lefkosa: 5Girne-Lefkosa: 5Lefkosa-Akdogan: 7Lefkosa-Akdogan: 7Sum: 5+7: 12Sum: 5+7: 12
8
10
3
58
72
Girne
Guzelyurt Lefkosa
Akdogan
Gazimagosa
10 5 8
12
Dijkstra Algorithm
4) Check the values minimum or not4) Check the values minimum or not If not updated again.If not updated again.
Girne-Gazimagosa: 8Girne-Gazimagosa: 8Lefkosa-Akdogan: 2Lefkosa-Akdogan: 2Sum: 8+2: 10Sum: 8+2: 10
9
10
3
58
72
Girne
Guzelyurt Lefkosa
Akdogan
Gazimagosa
10 5 8
10
Dijkstra Algorithm
5)5) Check all nodes are visitedCheck all nodes are visited
Path:Path: Girne-Gazimagosa-AkdoganGirne-Gazimagosa-AkdoganDistance:Distance: 10 10
10
10
3
58
72
Girne
Guzelyurt Lefkosa
Akdogan
Gazimagosa
105 8
10
How The System Works
11
Conclusion
•The project gave me a good opportunity to experiment windows The project gave me a good opportunity to experiment windows form programming with C# programming language.form programming with C# programming language.
•I gained a great amount of experience in using the objects of I gained a great amount of experience in using the objects of Graphics classGraphics class..
•This project was a good experiment to turn the theoretical This project was a good experiment to turn the theoretical knowledge into practice.knowledge into practice.
12
References
•Thomas A. Standish.”Data Structures, Algorithms, and Software Principles”. Computer Thomas A. Standish.”Data Structures, Algorithms, and Software Principles”. Computer Science Department University of Calfornia,Irvine.ISBN 0-201-52880-0. May 1994.Science Department University of Calfornia,Irvine.ISBN 0-201-52880-0. May 1994.
•http://www.wordiq.com/definition/Dijkstra's_algorithmhttp://www.wordiq.com/definition/Dijkstra's_algorithm
•http://en.wikipedia.org/wiki/Graph_theoryhttp://en.wikipedia.org/wiki/Graph_theory
•Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Clifford (2001). "Section Cormen, Thomas H.; Leiserson, Charles E.; Rivest, Ronald L.; Stein, Clifford (2001). "Section 24.3: Dijkstra's algorithm". Introduction to Algorithms (Second ed.). MIT Press and McGraw-Hill. 24.3: Dijkstra's algorithm". Introduction to Algorithms (Second ed.). MIT Press and McGraw-Hill. pp. 595–601. ISBN 0-262-03293-7.pp. 595–601. ISBN 0-262-03293-7.
•http://www.dotnetperls.com/pathfindinghttp://www.dotnetperls.com/pathfinding
•http://en.wikipedia.org/wiki/Dijkstra's_algorithmhttp://en.wikipedia.org/wiki/Dijkstra's_algorithm
13
THANK YOU FOR LISTENINGTHANK YOU FOR LISTENING
14