getDepths method
Returns the depth of all vertices in the graph.
Performs a traversal considering the reverse path. Saves the depth of each vertex.
Implementation
@override
Map<Node, int> getDepths() {
final result = <Node, int>{};
visitDepthBacktrack((path) {
if (path.isNotEmpty) {
final node = path.last;
final index = path.length - 1;
result[node] = index;
}
return VisitResult.continueVisit;
});
return result;
}