Skip to main content

kautz

Function kautz 

Source
pub fn kautz(m: u32, n: u32) -> IgraphResult<Graph>
Expand description

Build the Kautz graph K(m, n).

The result is always directed (matches IGRAPH_DIRECTED in the C constructor). For n ≥ 1 every vertex has out-degree and in-degree equal to m.

§Errors

  • IgraphError::InvalidArgument(m+1)^(n+1) overflows u32, so the sparse string-code space cannot be addressed with the graph’s u32 vertex id width. The check uses u32::checked_pow so the failure mode is deterministic.
  • IgraphError::InvalidArgument — vcount (m+1) · m^n or ecount m · vcount overflows usize so the index tables / edge buffer cannot be sized safely.

§Examples

use rust_igraph::kautz;

// K(2, 1) — directed graph on 6 vertices; every vertex has
// out-degree 2 and in-degree 2 → 12 arcs total.
let g = kautz(2, 1).unwrap();
assert_eq!(g.vcount(), 6);
assert_eq!(g.ecount(), 12);
assert!(g.is_directed());