pub fn mycielskian(graph: &Graph, k: u32) -> IgraphResult<Graph>Expand description
Apply k Mycielski iterations to graph.
Returns a new graph that preserves the input’s directedness. Self-loops and parallel edges in the input are propagated through the construction rules literally — Mycielski is defined on simple graphs but the upstream extension to multigraphs is preserved here.
For k == 0 the result is a structural copy of graph (same vertices,
same edges, same directedness).
§Errors
IgraphError::InvalidArgument— the computed2^kvcount or3^k-scaled ecount overflowsu32/usize.
§Examples
use rust_igraph::{Graph, mycielskian};
// Mycielski of the null graph + 1 iteration = singleton.
let null = Graph::new(0, false).unwrap();
let m1 = mycielskian(&null, 1).unwrap();
assert_eq!(m1.vcount(), 1);
assert_eq!(m1.ecount(), 0);
// Mycielski of P_2 + 1 iteration = C_5 (Mycielski M_3).
let mut p2 = Graph::new(2, false).unwrap();
p2.add_edges([(0u32, 1u32)]).unwrap();
let c5 = mycielskian(&p2, 1).unwrap();
assert_eq!(c5.vcount(), 5);
assert_eq!(c5.ecount(), 5);