Skip to content

Instantly share code, notes, and snippets.

@mcneja
mcneja / dijkstra.py
Last active April 16, 2018 14:17
Dijkstra fill in Python
import heapq
maxDistance = 2000
def computeDistanceMap(costMap, starts):
sizeY = len(costMap)
sizeX = len(costMap[0])
distMap = [[maxDistance for x in range(sizeX)] for y in range(sizeY)]
# Starting positions have a distance of zero and are scheduled