Skip to content

balajimk/dijkstraPython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

dijkstraPython

Coding Dijkstra's shortest path algorithm in Python.

The code uses py_linq from https://viralogic.github.io/py-enumerable/ to easily enumerate & query arrays.

You can learn the Dijkstra's algorithm from https://www.youtube.com/watch?v=pVfj6mxhdMw. The client code uses the problem solved in the youtube video.

Changes to the generally accepted logic

  • Instead of visited & unvisited vertices list, I have used visited flag in the Vertex class.
  • Using used flag on Edge class to be sure that the edge has been used to calculate the distance though this is not mandatory.

How to execute the code online

Browse https://repl.it/@BalajiMKala/dijkstraPython and click Run button.

How to run the code locally

Clone or download the code from this repository. Open the folder in Visual Studio code or your preferred text editor. Install py-linq by running the command in the prompt / terminal"

pip install py-linq

and to execute the code:

{full path to python}/python.exe {full path to the folder}/dijkstraClient.py

This is my first try with Python and so, bear with the issues :) Do message me if you have any questions and I'd reply at the earliest possible.

Nice to have changes

  • List of vertices should be generated from the edgesList provided.
  • Cases like, circular paths/loops, & directional edges.

About

Coding Dijkstra's shortest path in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages