Documentation
¶
Overview ¶
Package rmat implements the RMAT (Recursive MATrix) generator of Chakrabarti, Zhan & Faloutsos (SDM 2004), used to produce power-law-shaped synthetic graphs that match the degree distributions observed in real-world social / web networks.
The four parameters A, B, C, D sum to 1.0; their relative proportions control the graph's degree distribution. The canonical defaults are (0.57, 0.19, 0.19, 0.05), matching the Graph500 specification.
The recursive descent through the 2x2 probability matrix is shared with the catalogue generator at github.com/FlavioCFOliveira/GoGraph/internal/shapegen.RMAT via shapegen.RMATPick: both callers run the exact same Graph500 quadrant split (A iff v < a, B iff a <= v < a+b, C iff a+b <= v < a+b+c, D otherwise) in integer-percent arithmetic. The previous bench/rmat implementation split A from B at ab/2 instead of at a, which is correct only when a == b and silently diverged for the canonical (57, 19, 19, 5) tuple; sharing the picker fixes that bug at the source.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
Generate streams the RMAT edges into the supplied bulk.Loader. Returns the number of vertices and edges produced.
The picker delegates to shapegen.RMATPick so this bench shares its quadrant-split semantics with the catalogue generator. The caller-supplied (A, B, C, D) are rounded to the nearest integer percent in [0, 100]; the sum of the rounded percents must equal 100 or Generate panics with a deterministic, self-describing message. The all-zero case is treated as the canonical Graph500 default (0.57, 0.19, 0.19, 0.05) for backwards compatibility with the v1 API.
Types ¶
type Spec ¶
type Spec struct {
// Scale = log2(n_vertices). The generated graph has 2^Scale
// nodes.
Scale int
// EdgeFactor is the average degree; total edges = EdgeFactor *
// 2^Scale.
EdgeFactor int
// A, B, C, D are the RMAT quadrant probabilities; sum to 1.
// Defaults: 0.57 / 0.19 / 0.19 / 0.05 when zero.
A, B, C, D float64
// Seed is the PCG seed for reproducibility.
Seed uint64
}
Spec configures a Generate run.