Macro rs_graph::idxnodevec[][src]

macro_rules! idxnodevec {
    ($g:expr; $elem:expr) => { ... };
    ($g:expr, $vec:expr) => { ... };
}

Create a node vector associated with a graph.

Example

Create a vector with all elements set to some value, use idxnodevec![g; x]

let g = peterson::<LinkedListGraph>();
let weights = idxnodevec![&g; 0];
assert!(g.nodes().all(|u| weights[u] == 0));

Convert an existing vector to a IndexNodeVec, use nodevec![g, v]. Note that the size of v must be exactly g.num_nodes().

let g = peterson::<LinkedListGraph>();
let weights: Vec<_> = (0..g.num_nodes()).collect();
let weights = idxnodevec![&g, weights];
assert!(g.nodes().all(|u| weights[u] == g.node_id(u)));