compute depth graph.