hypergraphx 0.0.5

A hypergraph library for Rust, based on the Python library of the same name.
Documentation
use hashbrown::HashMap;

use crate::algo::k_shortest_path::k_shortest_path;
use crate::prelude::*;

#[test]
fn second_shortest_path() {
    hypergraph! {
        let mut graph: DirectedHypergraph<_, _> {
            nodes: {
                let a = ();
                let b = ();
                let c = ();
                let d = ();
                let e = ();
                let f = ();
                let g = ();
                let h = ();
                let i = ();
                let j = ();
                let k = ();
                let l = ();
                let m = ();
            };
            edges: {
                ([a] -> [b]) = ();
                ([b] -> [c]) = ();
                ([c] -> [d]) = ();
                ([b] -> [f]) = ();
                ([f] -> [g]) = ();
                ([c] -> [g]) = ();
                ([g] -> [h]) = ();
                ([d] -> [e]) = ();
                ([e] -> [h]) = ();
                ([h] -> [i]) = ();
                ([h] -> [j]) = ();
                ([h] -> [k]) = ();
                ([h] -> [l]) = ();
                ([i] -> [m]) = ();
                ([l] -> [k]) = ();
                ([j] -> [k]) = ();
                ([j] -> [m]) = ();
                ([k] -> [m]) = ();
                ([l] -> [m]) = ();
                ([m] -> [e]) = ();
                // [a, b] = ();
                // [b, c] = ();
                // [c, d] = ();
                // [b, f] = ();
                // [f, g] = ();
                // [c, g] = ();
                // [g, h] = ();
                // [d, e] = ();
                // [e, h] = ();
                // [h, i] = ();
                // [h, j] = ();
                // [h, k] = ();
                // [h, l] = ();
                // [i, m] = ();
                // [l, k] = ();
                // [j, k] = ();
                // [j, m] = ();
                // [k, m] = ();
                // [l, m] = ();
                // [m, e] = ();
            };
        }
    }

    let res = k_shortest_path(&graph, a, None, 2, |_| 1);

    let expected_res: HashMap<usize, usize> = [
        (e, 7),
        (g, 3),
        (h, 4),
        (i, 5),
        (j, 5),
        (k, 5),
        (l, 5),
        (m, 6),
    ]
    .iter()
    .cloned()
    .collect();

    assert_eq!(res, expected_res);
}