Expand description
Random dot-product graph generator (ALGO-GN-022).
Counterpart of igraph_dot_product_game() from
references/igraph/src/games/dotproduct.c:59-102.
§Model — Random Dot-Product Graph (RDPG)
Every vertex i ∈ [0, n) carries a latent position vector
v_i ∈ R^d. For every unordered pair (i, j) with i < j
(undirected) or ordered pair (i, j) with i ≠ j (directed), the
edge probability is
p_{i,j} = v_i · v_j (Euclidean inner product, length d)and the edge is realised by a single Bernoulli(p_{i,j}) draw. The
latent positions are caller-supplied — this generator only consumes
them and never tries to fit them. See Nickel (2006) and
Young–Scheinerman (2007) for the construction’s properties (degree
distribution as a function of position-vector marginals, etc.).
§Clamp semantics (mirroring the C reference exactly)
Latent inner products are not guaranteed to live in [0, 1]. The
C reference resolves the three regimes deterministically:
prob < 0→ no edge added. Sets thenegative_warningflag on the first occurrence so callers can audit (caller-side warning, noeprintln!here).prob > 1→ edge always added, no RNG draw consumed (the C reference deliberately short-circuits pastRNG_UNIF01). Sets theover_one_warningflag on the first occurrence.0 ≤ prob ≤ 1→ a singleRNG_UNIF01() < probdraw decides.
The PRNG-draw count therefore depends on how many pairs fall in the
[0, 1] band — exactly mirroring the C kernel. Conformance is
structural (vcount, directed flag, simple-by-construction, no
self-loops, edge-count bound) rather than bit-exact because
SplitMix64 is not bit-portable to upstream’s
glibc-style stream.
§Construction guarantees
- Never produces a self-loop. The
i == jslot is short- circuited explicitly in the directed loop; the undirected loop startsjati + 1so it cannot reachi. - Always simple. Each (un)ordered pair is inspected exactly once, so multi-edges are impossible by construction.
- Bounded edge count: at most
n · (n − 1) / 2undirected, at mostn · (n − 1)directed.
§Determinism
Reproducible given (vecs, directed, seed) against the shared
SplitMix64 PRNG.
Structs§
- DotProduct
Warnings - Outcome of
dot_product_game_with_warnings.
Functions§
- dot_
product_ game - Sample a random dot-product graph (Nickel 2006) — silent variant.
- dot_
product_ game_ with_ warnings - Sample a random dot-product graph from caller-supplied latent position vectors and report whether clamp regimes were hit.