Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Shortest Path
#1
I have a graph of a map based on Tuples in Python. So I have to calculate the shortest path (Dijkstra) between two Tuples. My paths are generated by a function

add_path((0, 0, compass.east), (1, 0, compass.west))
add_path((0, 1, compass.north), (0, 2, compass.south))
add_path((0, 2, compass.north), (0, 3, compass.south))
...
First Tuple is "start" based on x,y-Coordinates and a direction. 
Second Tuple is "end" based on x,y-Coordinates and a direction.

So the Shortest Path is called by dijkstra((0,0), (2,2)). So now the shortest path between these coordinates should returned full with path. The distance should calculated by euclidean distance..


So now I need help, how i should start and build my functions. Python3 is required.
Reply
#2
check out: http://www.codehamster.com/2015/03/09/di...in-python/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Shortest path from s to t using python nkiki 9 623 Jan-28-2024, 05:58 PM
Last Post: Gribouillis
  position of shortest string Ali_ 2 1,430 Mar-17-2022, 03:48 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020