Skip to main content

is_proper_coloring

Function is_proper_coloring 

Source
pub fn is_proper_coloring(graph: &Graph, coloring: &[u32]) -> IgraphResult<bool>
Expand description

Check whether a coloring is valid (proper).

A proper coloring assigns colours such that no two adjacent vertices share the same colour.

ยงExamples

use rust_igraph::{Graph, greedy_coloring, is_proper_coloring};

let g = Graph::from_edges(&[(0,1),(1,2)], false, Some(3)).unwrap();
let c = greedy_coloring(&g).unwrap();
assert!(is_proper_coloring(&g, &c).unwrap());