Adds a A* implementation

This commit is contained in:
Johann Dreo 2014-03-18 11:08:05 +01:00
commit 4f38a2c6cd
2 changed files with 94 additions and 0 deletions

8
graph.py Normal file
View file

@ -0,0 +1,8 @@
def graph( segments ):
graph = {}
for start,end in segments:
graph[start] = graph.get( start, [] ).append( end )
graph[end] = graph.get( end, [] ).append( start )
return graph