To measure the shortest distance of any nodes or any particular points, we can use this package. By using this package, we will get the shortest path and also the distance.
Project description
DijsktraAlgorithm
Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a graph. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years later. Here, I used his method in python to find the shortest path and also the distance.
Installing
Run the following code to install on your terminal:
pip install DijkstraAlgorithm
Using
Follow the given way to use it:
'''First Import our module'''
import DijkstraAlgo as da
'''Initializing the Class Attributes'''
x = da.DijkstraAlgorithm()
'''Now pass the arguments through the following method'''
x.dijkstraWithPath(graph, source, destination) #Here, this graph is about the distance between each nodes.
'''Lets define some methods'''
shortest_path = x.path()
distance = x.distance()
print(*shortest_path) #It will print the path
print(*distance) #It will print the distance
Plugins
Few useful links:
License
MIT
Free Software, Happy Coding!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file DijkstraAlgo-0.0.1.tar.gz
.
File metadata
- Download URL: DijkstraAlgo-0.0.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80509145a8897eb35f58766ec3ec46b117d2239d19314596023d0459464a3c47 |
|
MD5 | 6e04fdb514910f8c2621733e06bde70b |
|
BLAKE2b-256 | e97b51de6db168ba7f283e41e0dd6eb64b88de4ac5312ba2135e5c680a426b84 |
Provenance
File details
Details for the file DijkstraAlgo-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: DijkstraAlgo-0.0.1-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d1d2ba3ea249360177c61a0a462d81a4d95da0b6c714f05b22cf3aad34f0614 |
|
MD5 | 36fdfc6e4c1cab33d3a40b5a2a3d1022 |
|
BLAKE2b-256 | 7d4fb64d1ac8dbfe164203bc442e24aa441790c05702471e650374f9bcc53da7 |