Skip to content

Instantly share code, notes, and snippets.

@jbartolozzi
jbartolozzi / topological.py
Created July 22, 2016 17:56 — forked from kachayev/topological.py
Topological sort with Python (using DFS and gray/black colors)
# Simple:
# a --> b
# --> c --> d
# --> d
graph1 = {
"a": ["b", "c", "d"],
"b": [],
"c": ["d"],
"d": []
}