def _depth(g):
def _explore(v):<EOL><INDENT>if v.depth < <NUM_LIT:0>:<EOL><INDENT>v.depth = ((<NUM_LIT:1> + max([-<NUM_LIT:1>] + [_explore(annotated_graph[u])<EOL>for u in v.parents]))<EOL>if v.parents else <NUM_LIT:0>)<EOL><DEDENT>return v.depth<EOL><DEDENT>annotated_graph = {k: _Node(k, v) for k, v in g.items()}<EOL>for v in annotated_graph.values():<EOL><INDENT>_explore(v)<EOL><DEDENT>return annotated_graph<EOL>
Computes the number of edges on longest path from node to root.