Skip to content

remykarem/visualise-dijkstra-shortest-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visualise shortest path using Dijkstra's algorithm

Features

  • Generate random graphs and parse from string
  • Calculate the shortest path

Examples

>>> from dijsktra import Graph
>>> g = Graph.generate_random()
>>> g.view()

graph

>>> g.find_shortest_path("g->f")

graph-highlighted

>>> s = """
jln ahmad ibrahim, corporation, 4
corporation, teban, 3
teban, pie jeast, 5
jln ahmad ibrahim, pie jwest, 10
pie jwest, pie jeast, 3
teban, clementi, 2
clementi, clementi rd, 2
clementi rd, buona vista, 3
buona vista, alexandra, 4
pie jeast, pie imm, 3
pie imm, toh tuck, 1
toh tuck, bt timah, 4
"""
>>> g = Graph.from_string(s)
>>> g.view()

graph2

>>> g.find_shortest_path("teban->pie jeast")

graph2-highlight

Resources

Priority queues using heapq in Python (realpython.com)

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages