Skip to content

Instantly share code, notes, and snippets.

@joninvski
joninvski / bellman.py
Created November 16, 2010 11:31
Bellman ford python implementation
import pdb
"""
The Bellman-Ford algorithm
Graph API:
iter(graph) gives all nodes
iter(graph[u]) gives neighbours of u
graph[u][v] gives weight of edge (u, v)
"""