Skip to main content

Crate use_graph_path

Crate use_graph_path 

Source
Expand description

Primitive path helpers.

The crate keeps path handling explicit through a small Path wrapper and a breadth-first shortest-path helper for unweighted graphs.

§Examples

use use_graph_path::{Path, is_valid_path, shortest_path_unweighted};

let adjacency = vec![vec![1], vec![2], vec![]];
let shortest = shortest_path_unweighted(&adjacency, 0, 2).unwrap().unwrap();
let path = Path::new(vec![0, 1, 2]).unwrap();

assert_eq!(shortest.nodes(), &[0, 1, 2]);
assert!(is_valid_path(&adjacency, path.nodes()).unwrap());

Structs§

Path

Enums§

PathError

Functions§

is_valid_path
shortest_path_unweighted