graph.py: new depth computation