ratio-graph 0.23.3

Ratio's graph manipulation library.
Documentation
use std::collections::{BTreeMap, BTreeSet};

use ratio_graph::*;

pub fn mock_graph() -> Graph {
    let a = Node {
        metadata: Metadata::new(
            None,
            Some("A".to_string()),
            Some("a kind".to_string()),
            Some(BTreeSet::from(["alike".to_string(), "like a".to_string()])),
            Some(BTreeMap::from([("heft".to_string(), 4.0)])),
            None,
        ),
        ..Default::default()
    };
    let b = Node {
        metadata: Metadata::new(
            None,
            Some("B".to_string()),
            Some("b kind".to_string()),
            Some(BTreeSet::from(["alike".to_string(), "like b".to_string()])),
            Some(BTreeMap::from([("heft".to_string(), 3.0)])),
            None,
        ),
        ..Default::default()
    };

    let e = Edge {
        metadata: Metadata::new(
            None,
            Some("a->b".to_string()),
            Some("edgy".to_string()),
            Some(BTreeSet::from(["conn".to_string()])),
            Some(BTreeMap::from([("adjacency".to_string(), 7.0)])),
            None,
        ),
        source: *a.id(),
        target: *b.id(),
    };

    Graph::new(
        Some(Metadata::new(
            None,
            Some("ab_graph".to_string()),
            None,
            None,
            None,
            None,
        )),
        vec![a, b],
        vec![e],
    )
    .unwrap()
}