Skip to main content

Module full

Module full 

Source
Expand description

Full graph (complete graph) constructor (ALGO-CN-014).

Counterpart of igraph_full() in references/igraph/src/constructors/full.c:54-124.

In a full graph every possible edge is present: every vertex is connected to every other vertex. The two boolean flags shape the ecount:

directedloopsecountemission pattern
falsefalsen·(n−1)/2(i, j) for every 0 ≤ i < j < n
falsetruen·(n+1)/2(i, j) for every 0 ≤ i ≤ j < n
truefalsen·(n−1)(i, j) for every i ≠ j
truetrue(i, j) for every 0 ≤ i, j < n

Emission order matches upstream byte-for-byte (source-major, target-ascending; for the directed && !loops case the inner loop walks j ∈ [0, i) first then j ∈ (i, n)).

Time complexity: O(|V|^2) = O(|E|).

Degenerate inputs:

  • n == 0 → empty graph (vcount = 0, ecount = 0).
  • n == 1 ∧ loops == false → singleton, no edges.
  • n == 1 ∧ loops == true → singleton with a single self-loop (0, 0).

Functions§

full_graph
Build the full (complete) graph on n vertices.