First commit
This commit is contained in:
commit
3e5ecb39ff
3 changed files with 25 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.pyc
|
||||||
|
*.swp
|
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Dijkstra's Shortest Path Algorithm
|
||||||
|
|
||||||
|
This is an implementation of Dijkstra's Shortest Path Algorithm in python
|
20
algorithm.py
Normal file
20
algorithm.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
"""Dijkstra's Shortest Path Algorithm"""
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
"""Implementation of the Shortest Path algorithm"""
|
||||||
|
|
||||||
|
neighbors = {
|
||||||
|
"a": [("b", 6), ("d", 1)],
|
||||||
|
"b": [("a", 6), ("c", 5), ("e", 2)],
|
||||||
|
"c": [("b", 5), ("e", 5)],
|
||||||
|
"d": [("a", 1), ("b", 2), ("e", 1)],
|
||||||
|
"e": [("b", 2), ("c", 5), ("d", 1)],
|
||||||
|
}
|
||||||
|
|
||||||
|
visited = []
|
||||||
|
unvisted = ["a", "b", "c", "d", "e"]
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
Loading…
Reference in a new issue