Skip to content

Instantly share code, notes, and snippets.


Sofya Tuymedova stuymedova

  • Looking for work
View GitHub Profile
# Old code initially implemented as part of a proof of concept example
# from "Algorithms Unlocked" by Thomas H. Cormen (see "arbitrage opportunity" p.105)
def bellman_ford(graph, source):
dist = {} # distance
pred = {} # predecessor
# Step 1: initialize the graph
for v in graph:
dist[v] = float('Inf')