Skip to main content

compute_depth

Function compute_depth 

Source
pub fn compute_depth(
    node: &str,
    importers_by_file: &HashMap<String, HashSet<String>>,
    memo: &mut HashMap<String, usize>,
    in_stack: &mut HashSet<String>,
) -> usize
Expand description

Compute depth for a single node via DFS + memoization. depth(M) = max(1 + depth(importer) for importer in importers_by_file[M]), base 0.