Documentation
¶
Overview ¶
Example 05_out_of_core — writes a Tier 2 csrfile, opens it via mmap, applies a SEQUENTIAL access hint, and runs PageRank directly over the mapped region, then verifies the result against the graph's symmetry.
Tier 2 is GoGraph's external-memory storage tier: the CSR adjacency lives on disk in the csrfile binary format and is read back by mmap'ing the file and reinterpreting its aligned sections as typed slices in place — no parse, no copy into the heap. This contrasts with Tier 1, the fully in-memory CSR snapshot built by csr.BuildFromAdjList. The semi-external PageRank keeps only the rank vector in RAM (size = number of vertices) while streaming the adjacency sequentially from the mapped file on every iteration, so the working set is bounded by the vertex count rather than the edge count.
The graph is a uniform 1000-node directed ring (i -> (i+1) mod 1000). Because every node has exactly one in-edge and one out-edge, the PageRank stationary distribution is perfectly uniform: every live node holds rank 1/1000 = 0.001, so the example verifies the computation by checking that the minimum and maximum live ranks are equal and match a sampled node's rank.
Sample output: run `go run ./examples/05_out_of_core` and capture the stdout — the output is deterministic for the inputs hard-coded above and serves as the regression baseline a future change should preserve. The csrfile is written to an os.MkdirTemp directory whose absolute path varies per run, so the report never prints that path.