Вы находитесь на странице: 1из 14

# Shortest Path Between Two Nodes on a Potential Railway System In Cyprus

## Mr. Erdogan Kaygan (European University of Lefke)

CONTENTS

Introduction Aim Of The Project Graph Theory Dijkstra Algorithm How The System Works( Software) Conclusion References
2

Introduction

Most common problem in computer science. Shortest path problem is the problem of finding a path between two vertices. Aim of the project: Finding and calculating the shortest way to get from one location to another on a Cyprus railway map.

Graph Theory

## Directed Graph Directed graph defined as G = (V,E)

where;
V: a set of vertices and E: a set of edges

V1 E3 V3

E1 V2

E2

## Figure1 Directed Graph

Graph Theory

Adjacent List Each vertex has a list of which vertices it is adjacent to. Example:
V1 Vertices V1 V2 V3 Adjacent List V2, V3 V1, V3 V1, V2 Table1. Adjacent List E3 V3

E1 V2 E2

## Figure2 Directed Graph

Dijkstra Algorithm

## Designed to find the shortest path between two nodes.

Girne

Algorithm steps

10 5

8 Gazimagosa

1) Select current node 0 Set the value of all other nodes to infinity. Mark nodes unvisited

Guzelyurt

3 Lefkosa 7

Akdogan

Dijkstra Algorithm

## 2) Update new value for visited node Check the smallest.

Girne 10 5 10 5 8 Gazimagosa 8 2

## Girne-Guzelyurt: 10 Girne-Lefkosa: 5 Girne-Gazimagosa: 8

Guzelyurt

3 Lefkosa 7

Akdogan

Dijkstra Algorithm

## Girne-Lefkosa: 5 Lefkosa-Akdogan: 7 Sum: 5+7: 12

Guzelyurt

3 Lefkosa 7

Dijkstra Algorithm

4) Check the values minimum or not If not updated again. Girne-Gazimagosa: 8 Lefkosa-Akdogan: 2 Sum: 8+2: 10

## Girne 10 5 10 5 8 Gazimagosa 8 2 10 Akdogan

Guzelyurt

3 Lefkosa 7

Dijkstra Algorithm

## 5) Check all nodes are visited Path: Girne-Gazimagosa-Akdogan Distance: 10

10 5 10 Guzelyurt

3 Lefkosa 7

## How The System Works

11

Conclusion

The project gave me a good opportunity to experiment windows form programming with C# programming language.
I gained a great amount of experience in using the objects of Graphics class. This project was a good experiment to turn the theoretical knowledge into practice.
12

References

Thomas A. Standish.Data Structures, Algorithms, and Software Principles. Computer Science Department University of Calfornia,Irvine.ISBN 0-201-52880-0. May 1994.

http://www.wordiq.com/definition/Dijkstra's_algorithm
http://en.wikipedia.org/wiki/Graph_theory 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. pp. 595601. ISBN 0-262-03293-7. http://www.dotnetperls.com/pathfinding http://en.wikipedia.org/wiki/Dijkstra's_algorithm
13

14