Expand description
Callaway-Hopcroft-Kleinberg-Newman-Strogatz traits game (ALGO-GN-016).
Counterpart of igraph_callaway_traits_game() from
references/igraph/src/games/callaway_traits.c:71. Models a growing
graph with vertex types: at each step a new vertex is added, then
edges_per_step candidate edges are generated by picking two
uniformly random vertices from those already added (including the
new one) and accepting the edge with probability
pref_matrix[type1][type2].
§Algorithm
- Build a cumulative distribution from
type_dist(or the uniform distribution whentype_dist == None). Reject ifmaxcum <= 0. - Pre-assign every vertex
v ∈ [0, nodes)a categorical type by drawing a uniform sample in[0, maxcum)and binary-searching the cumulative table. - For each step
i ∈ [1, nodes)and each_ ∈ [0, edges_per_step), drawnode1, node2uniformly in[0, i](inclusive — both can equali, the just-added vertex). Accept the candidate edge(node1, node2)with probabilitypref_matrix[type[node1]][type[node2]].
§Self-loops & multi-edges
Unlike establishment_game, this generator can return self-loops
(node1 == node2) and parallel edges (the same (node1, node2)
pair drawn twice). The output is therefore not simple by
construction.
§Determinism
Reproducible given the inputs and seed against the shared
SplitMix64 PRNG. The stream is not portable
to upstream igraph’s GLIBC RNG, so conformance assertions are
structural (vertex/edge counts, type-vector range, support of the
preference matrix) rather than bit-exact.
§References
- D. S. Callaway, J. E. Hopcroft, J. M. Kleinberg, M. E. J. Newman, and S. H. Strogatz, “Are randomly grown graphs really random?”, Phys. Rev. E 64, 041902 (2001).
Functions§
- callaway_
traits_ game - Generates a random graph with vertex types via the Callaway et al. (2001) growing model.