This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from graphviz import Digraph | |
def trace(root): | |
# builds a set of all nodes and edges in a graph | |
nodes,edges = set(), set() | |
def build(v): | |
if v not in nodes: | |
nodes.add(v) | |
for child in v._prev: |