Module metrics

Module metrics 

Source
Expand description

Graph metrics and statistics.

This module provides lightweight statistical analysis of dependency graphs.

§Examples

use ascii_dag::layout::generic::metrics::GraphMetrics;

let get_deps = |task: &&str| match *task {
    "deploy" => vec!["build", "test"],
    "build" => vec!["compile"],
    "test" => vec!["compile"],
    "compile" => vec![],
    _ => vec![],
};

let tasks = ["deploy", "build", "test", "compile"];
let metrics = GraphMetrics::compute(&tasks, get_deps);

assert_eq!(metrics.node_count(), 4);
assert_eq!(metrics.edge_count(), 4);
// Max depth varies based on path (deploy has ancestors [build, compile] or [test, compile])
assert!(metrics.max_depth() >= 2);

Structs§

GraphMetrics
Statistical metrics for a dependency graph.