Skip to main content

Crate use_weighted_graph

Crate use_weighted_graph 

Source
Expand description

Primitive weighted graph helpers.

The crate provides a small weighted-edge type plus adjacency builders and a few helpers for summarizing edge weights.

§Examples

use use_weighted_graph::{WeightedEdge, build_weighted_directed_adjacency, path_weight};

let edge = WeightedEdge::new(0, 1, 2.5).unwrap();
let adjacency = build_weighted_directed_adjacency(2, &[edge]).unwrap();

assert_eq!(adjacency, vec![vec![(1, 2.5)], vec![]]);
assert_eq!(path_weight(&[edge]), Some(2.5));

Structs§

WeightedEdge

Enums§

WeightedGraphError

Functions§

build_weighted_directed_adjacency
build_weighted_undirected_adjacency
max_weight_edge
min_weight_edge
path_weight

Type Aliases§

WeightedAdjacencyList