Skip to main content

Module extended_chordal_ring

Module extended_chordal_ring 

Source
Expand description

Extended chordal ring constructor (ALGO-CN-028).

Counterpart of igraph_extended_chordal_ring() in references/igraph/src/constructors/regular.c:868-963.

An extended chordal ring is the cycle C_n together with one additional chord per row of a chord matrix W. The matrix is interpreted in upstream igraph as follows:

  • period = ncol(W). The period must divide nodes.
  • For every vertex i ∈ [0, nodes) and every row j ∈ [0, nrow(W)) the constructor emits the directed edge (i, (i + W[j][i mod period]) mod nodes). Matrix entries are allowed to be negative — the result is reduced into [0, nodes) with Euclidean modulus.

The total edge count is therefore nodes + nodes * nrow(W) (plus an extra factor of 2 only inside the candidate buffer — igraph_create still treats each (i, v) as a single directed/undirected edge). The result is not simplified: matrix patterns that produce the same chord twice (e.g. the article example with W = [[4, 2], [8, 10]] on 12 nodes) intentionally retain the parallel edges so the caller can preserve the published multigraph or simplify it themselves.

Rust matrix encoding: w is passed as &[&[i64]] — a slice of rows where every row has the same length (the period). An empty w (no rows) skips the chord pass entirely and returns the bare cycle C_n; the upstream divide-by-zero in that case is replaced with a defensive no-op.

Degenerate / error cases (matching upstream wherever it is defined):

Time complexity: O(|V| + |E|) = O(nodes · (1 + nrow)).

Functions§

extended_chordal_ring
Build the extended chordal ring R(nodes, W).