Expand description
Last-citation game (ALGO-GN-018).
Counterpart of igraph_lastcit_game() from
references/igraph/src/games/citations.c:91-209. Models an
evolving citation network where a vertex’s attractivity decays with
the time elapsed since its last citation, binned into agebins age
buckets.
§Algorithm
Time is measured by vertex arrival; binwidth = nodes / agebins + 1.
Every vertex v carries a weight in a prefix-sum tree:
- Vertex
0enters with the “never-cited” weightpreference[agebins]. - For each step
i ∈ [1, nodes):- For each of
edges_per_nodeoutgoing edges, drawu ∈ [0, sum)uniformly andpsumtree.search(u)returns the cited vertexto. Recordlastcit[to] = i + 1, bumpto’s weight topreference[0](just-cited bucket). - When
sum == 0(no positive weight anywhere — only possible ifpreference[agebins]and allpreference[..agebins]happen to be zero, but the validator already rejects that), the C reference falls back toRNG_INTEGER(0, i-1); we mirror it. - Insert vertex
iwith weightpreference[agebins]. - Age sweep: for each
k ≥ 1such thatshnode = i - k·binwidth ≥ 1, walkshnode’s emitted citations and, for every cited vertexcwhoselastcit[c] == shnode + 1(i.e. its last citation really was atshnode), demote its weight topreference[k].
- For each of
The structure is a binary-indexed (Fenwick) tree with binary-lifting prefix-search, giving O(log n) per update / search.
§Self-loops & multi-edges
- Self-loops: impossible.
psumtree.searchand thesum=0fallback both operate over the[0, i)index range; vertexiis added after its outgoing edges are drawn, so it cannot be picked. - Multi-edges: yes, when
edges_per_node ≥ 2. Two draws at the same step can land on the same target. Caller shouldsimplify()if simple output is required (matches upstream behaviour).
§Determinism
Reproducible against the shared SplitMix64
PRNG. Not bit-portable to upstream igraph’s GLIBC RNG; conformance
asserts structural invariants only.
§References
- Upstream igraph C
igraph_lastcit_game, MIT-licensed reference port.
Functions§
- lastcit_
game - Last-citation citation-network game. See module docs.