Expand description
Basic edge-list graph constructor (ALGO-CN-022).
Counterpart of igraph_create() in
references/igraph/src/constructors/basic_constructors.c:53-81.
Build a graph from a flat edge list, automatically extending the
vertex count to accommodate the largest endpoint when n == 0 or
when n is smaller than max(edges) + 1 (upstream behaviour —
callers passing 0 get the smallest graph that holds every edge).
Upstream igraph_create accepts a flat igraph_vector_int_t of
length 2·|E| ([u0, v0, u1, v1, …]) and reports IGRAPH_EINVAL
on an odd length and IGRAPH_EINVVID on a negative vertex id. The
Rust signature is &[(u32, u32)], which eliminates both error
paths at the type-system level (pairs cannot be odd; u32 cannot
be negative), so the only remaining runtime check is the silent
n := max(max_edge_endpoint + 1, n) upper-bound logic.
The igraph_small varargs convenience is intentionally not
ported: Rust call sites use a Vec/slice literal like
create(&[(0, 1), (1, 2), (2, 3)], 4, false) which is already
terse, and Rust has no va_list.
Functions§
- create
- Build a graph from a flat edge list.