code wiki / _hdl_build / nx_pagerank_build.nx
nx_pagerank_build.nx
buildroot/runtime/_hdl_build/nx_pagerank_build.nx
about
nx_pagerank_build.nx -- P1 STEP 2: build the web LINK GRAPH from out:<cid> edge rows (captured by
nx_web_crawl_step's outlink capture) and compute PageRank authority, storing pr:<cid> priors back into the
web shard. Node identity = cid(url) (the frontier/outlink hash) -> an out: key's cid is the source node,
its packed-i64 value are the target nodes. Interns cids to dense indices, runs pr_compute (nx_pagerank),
stores pr:<cid> = rank. Serve-time authority (step 3) = content_cid -> url:<cid> -> ci_hash(url) -> pr:<cid>.
usage: nx_pagerank_build [domain=web] [iters=100]
license_tier: ORIGINAL
dependencies 3 imports · 1 importers
imports: nx_corpus_ingest.nxnx_itoa_lib.nxnx_pagerank.nx
imported by: nx_pagerank_build_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 11 | const PB_MAGIC_16777216: i64 = 16777216 |
| 12 | const PB_MAGIC_1000000: i64 = 1000000 |
| 17 | const PB_MAXNODE: i64 = 16777216 // distinct nodes per run (16M; one ~40k-page WARC links ~1-4M targets) |
| 18 | const PB_MAXEDGE: i64 = 33554432 // directed edges per run (32M) |
| 19 | const PB_HSIZE: i64 = 33554432 // hash slots = 2^25 (2x MAXNODE load-factor headroom) |
| 20 | const PB_HSHIFT: i64 = 38 // take the TOP 25 bits of the 63-bit mixed hash (63 - 25) |
| 21 | const PB_HMUL: i64 = 7046029254386353131 // odd 63-bit multiplicative-mix constant (Fibonacci-hash family) |
functions
| 23 | func pb_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 28 | func pb_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 30 | func pb_key_cid(k: *u8, kl: i64) -> i64 called by 1: pb_collect |
| 36 | func pb_prkey(cid: i64, out: *u8) -> i64 |
| 51 | func pb_hslot(cid: i64) -> i64 |
| 58 | func pb_intern(cid: i64, cidtab: *i64, idxtab: *i64, node: *i64, nn: *i64) -> i64 |
| 79 | func pb_seen(cid: i64, seentab: *i64) -> i64 |
| 93 | func pb_collect(h: *i64, cidtab: *i64, idxtab: *i64, seentab: *i64, node: *i64, nn: *i64, efrom: *i64, eto: *i64, srcflag: *u8) -> i64 |
| 148 | func pb_run(prefix: *u8, iters: i64, segid0: i64) -> i64 |
| 198 | func main(argc: i64, argv: *i64) -> i64 |