Skip to content

Instantly share code, notes, and snippets.

View mahaalkh's full-sized avatar

mahaalkh mahaalkh

View GitHub Profile
@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)
"""