Skip to content

Instantly share code, notes, and snippets.

View mzmmoazam's full-sized avatar

Moazam mzmmoazam

View GitHub Profile
@mzmmoazam
mzmmoazam / gist:ecca2a5035cc742f042360172c53e8de
Created April 15, 2017 08:25 — forked from econchick/gist:4666413
Python implementation of Dijkstra's Algorithm
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):