Skip to content

Instantly share code, notes, and snippets.

View feng409's full-sized avatar
😡
write bug

呃哦 feng409

😡
write bug
View GitHub Profile
@feng409
feng409 / gist:32d18e8b1be0f89335cf61a9f01d0029
Created August 11, 2019 09:34 — 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):