Use multiple force-directed layout algorithms to improve graph readability

finchie
Apr 22, 2024, 10:16 AM
475UXTLYE5LQTMOGOFYC5Z5Z45YJ32M4GD2WOBTXZRBXKUSWFW2AC

Dependencies

  • [2] UXJFRBBL Move graph functionality into `graph` module
  • [3] 7CVIL7UJ Create simple metadata parser
  • [4] Q3Z6XMP5 Migrate dependency tree to `petgraph::Graph`
  • [5] B2L26LOA Store index of dependency nodes
  • [6] JVYWRCPT Add basic chart visualisation
  • [7] OPTMCUTB Use timings `duration` to set size of rendered node
  • [8] UQJO24KB Use `forceatlas2` to construct graph layout
  • [9] ZPFD3275 Switch from `cargo_metadata`+`petgraph` to `guppy`

Change contents

  • replacement in src/main.rs at line 1
    [3.32][3.48:85](),[3.48][3.48:85]()
    use charming::{Chart, HtmlRenderer};
    [3.49]
    [2.0]
    use charming::{series::GraphLayoutForce, Chart, HtmlRenderer};
  • replacement in src/main.rs at line 18
    [3.1397][3.1315:1372]()
    .layout(charming::series::GraphLayout::None)
    [3.1397]
    [3.1436]
    // Use charming's force-directed layout, in combination with
    // `graph::layout()` using `forceatlas2`, as they seem to get the best results
    // when used together.
    .layout(charming::series::GraphLayout::Force)
    .force(GraphLayoutForce::new().layout_animation(false))
  • edit in src/graph.rs at line 12
    [2.352]
    [2.352]
    timings: &timings::Output,
  • replacement in src/graph.rs at line 29
    [2.1011][2.1011:1036]()
    .map(|_id| 1.0);
    [2.1011]
    [2.1036]
    .map(|id| timings.pkg_time(id).unwrap_or(0_f64));
  • replacement in src/graph.rs at line 52
    [2.1768][2.1768:1807]()
    let layout = layout(&package_set);
    [2.1768]
    [2.1807]
    let layout = layout(&package_set, timings);