Skip to main content

bandwidth_of_labeling

Function bandwidth_of_labeling 

Source
pub fn bandwidth_of_labeling(
    graph: &Graph,
    labeling: &[u32],
) -> IgraphResult<u32>
Expand description

Compute the bandwidth of a specific labeling.

The labeling is given as a permutation: labeling[i] is the label assigned to vertex i.

ยงExamples

use rust_igraph::{Graph, bandwidth_of_labeling};

let g = Graph::from_edges(&[(0,1),(1,2),(2,3)], false, Some(4)).unwrap();
// identity labeling: max |i-j| over edges = max(1,1,1) = 1
assert_eq!(bandwidth_of_labeling(&g, &[0,1,2,3]).unwrap(), 1);
// reversed labeling: max |3-2|,|2-1|,|1-0| = 1
assert_eq!(bandwidth_of_labeling(&g, &[3,2,1,0]).unwrap(), 1);