Skip to main content

lcf

Function lcf 

Source
pub fn lcf(n: u32, shifts: &[i64], repeats: u32) -> IgraphResult<Graph>
Expand description

Construct an undirected graph from LCF notation.

n is the vertex count, shifts is the chord shift sequence (entries may be negative — wraparound is modular), and repeats controls how many full passes over shifts to walk.

The result is always undirected and always simple (self-loops and parallel edges introduced by the chord pattern are removed in place).

§Errors

§Examples

use rust_igraph::lcf;

// Franklin graph: [5, -5]^6 on n=12 — 12 vertices, 18 edges, bipartite cubic.
let franklin = lcf(12, &[5, -5], 6).unwrap();
assert_eq!(franklin.vcount(), 12);
assert_eq!(franklin.ecount(), 18);
assert!(!franklin.is_directed());