[][src]Type Definition rs_graph::vec::NodeVec

type NodeVec<'a, G, T> = ItemVec<NodeIndexer<'a, G>, T>;

A vector containing a value for each node.

Example

Create a vector with all elements set to some value.

let g = peterson::<LinkedListGraph>();
let weights = rs_graph::vec::NodeVec::new(&g, 0);
assert!(g.nodes().all(|u| weights[u] == 0));

Create a vector with an initialization function.

let g = peterson::<LinkedListGraph>();
let weights = rs_graph::vec::NodeVec::new_with(&g, |u| g.node_id(u));
assert!(g.nodes().all(|u| weights[u] == g.node_id(u)));