Skip to content

Instantly share code, notes, and snippets.

@peanutwolf
peanutwolf / dijkstra.py
Created January 30, 2016 11:38 — forked from mdsrosa/dijkstra.py
Modified Python implementation of Dijkstra's Algorithm (https://gist.github.com/econchick/4666413)
from collections import defaultdict, deque
class Graph(object):
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):