Created
October 18, 2015 20:16
-
-
Save duartenina/6186c34e6ffc50b44f7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def build_min_table(self): | |
self.mins = {} | |
for ID in range(1, len(self.mapa.cities) + 1): | |
self.mins[ID] = {} | |
connects = self.mapa.cities[ID - 1].connects | |
if len(connects) < 1: | |
for kind in self.kinds: | |
self.mins[ID][kind] = 10**6 | |
return | |
self.mins[ID] = connects[0].cost | |
for connect in connects: | |
for kind in self.kinds: | |
if connect.cost[kind] < self.mins[ID][kind]: | |
self.mins[ID][kind] = connect.cost[kind] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment