Adds a A* implementation
This commit is contained in:
parent
77725b9597
commit
4f38a2c6cd
2 changed files with 94 additions and 0 deletions
8
graph.py
Normal file
8
graph.py
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue