Created
September 2, 2019 02:48
-
-
Save alexgolec/142501dca248bf05f142b900da6110a3 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 add_conversion(self, orig, dest, rate): | |
'Insert a conversion into the graph. Note we insert its inverse also.' | |
if orig not in self.graph: | |
self.graph[orig] = {} | |
self.graph[orig][dest] = rate | |
if dest not in self.graph: | |
self.graph[dest] = {} | |
self.graph[dest][orig] = 1.0 / rate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment