code wiki / wiki / nx_wiki_graph.nx

nx_wiki_graph.nx

buildroot/runtime/wiki/nx_wiki_graph.nx

16190 B393 linesdepth 6pulls 6 transitivereach 6 importersview sourcekind librarytopic wiki
docsdependenciesstructsconstsfunctions

about

nx_wiki_graph.nx -- wiki R4: static connections / link-graph view. COMPOSES: nx_wiki_index_builder (page corpus: count + per-rowid title/url/ body) and nx_wiki_backlinks (the shared forward-[[wikilink]] extractor + slug matcher -- so graph edges and the backlinks panel agree on what a link is). nx_syscalls for scratch. MODEL: node = a page in the doc store (one per rowid). edge = a forward [[wikilink]] from page A's body to another page B that EXISTS as a node. src -> dst. broken = a forward [[wikilink]] whose target resolves to NO node (link rot). Broken links are COUNTED but are NOT nodes and NOT edges -- a dangling reference is rot, not a connection. OUTPUT: a self-contained, deterministic <svg> with a CIRCULAR layout -- nodes evenly spaced on a circle (positions from a fixed integer unit-circle table, no floating point, no trig dependency), <line> for each edge, <circle> + <text> for each node label. NO <script>, NO event handlers -> static SVG is sovereign and renders identically everywhere. (An interactive/force-directed graph is a documented JS follow-on, deliberately out of scope.) Hygiene: M1 out-params; M3 capped loops; M5 bounded indexing; M6 real semantics; M7 named constants; M8 propagated verdicts. Status: V1 (wiki R4). 2026-06-15. license_tier: ORIGINAL

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_wiki_index_builder.nx nx_wiki_backlinks.nx nx_wiki_graph.nx _wiki_backlinks_gate.nx nx_wiki_routes.nx

imports: nx_syscalls.nxnx_wiki_index_builder.nxnx_wiki_backlinks.nx

imported by: _wiki_backlinks_gate.nxnx_wiki_routes.nx

structs

55struct NxWikiGraph

consts

32const NX_WGRAPH_OK: i64 = 0
33const NX_WGRAPH_BAD_INPUT: i64 = 2680
34const NX_WGRAPH_OVERFLOW: i64 = 2681
35const NX_WGRAPH_LOOP_BUDGET: i64 = 2682
38const NX_WGRAPH_MAX_NODES: i64 = 1000 // mirrors doc-store docs cap
39const NX_WGRAPH_MAX_EDGES: i64 = 8192 // total edges across corpus cap
40const NX_WGRAPH_MAX_LINKS_PP: i64 = 512 // forward links per page cap
41const NX_WGRAPH_LOOP_BUDGET_C: i64 = 8000000
42const NX_WGRAPH_LABEL_GUARD: i64 = 512 // per-label byte cap (M3/M5)
46const NX_WGRAPH_W: i64 = 800
47const NX_WGRAPH_H: i64 = 800
48const NX_WGRAPH_CX: i64 = 400
49const NX_WGRAPH_CY: i64 = 400
50const NX_WGRAPH_R: i64 = 320 // ring radius
51const NX_WGRAPH_NODE_R: i64 = 7 // node dot radius
52const NX_WGRAPH_TBL: i64 = 24 // unit-circle table entries

functions

70func nx_wgraph_unit(k: i64, out_sin: *i64) -> i64
called by 1: nx_wgraph_node_xy
107func nx_wgraph_node_xy(i: i64, nc: i64, out_x: *i64, out_y: *i64) -> i64
128func nx_wiki_graph_build(store: *NxWikiDocStore, g: *NxWikiGraph) -> i64
208func nx_wiki_graph_node_count(g: *NxWikiGraph) -> i64
called by 1: main
212func nx_wiki_graph_edge_count(g: *NxWikiGraph) -> i64
called by 1: main
216func nx_wiki_graph_broken_count(g: *NxWikiGraph) -> i64
called by 1: main
227func nx_wgraph_emit(out: *u8, off: i64, cap: i64, s: *u8) -> i64
236func nx_wgraph_emit_bytes(out: *u8, off: i64, cap: i64, src: *u8, n: i64) -> i64
247func nx_wgraph_emit_num(out: *u8, off: i64, cap: i64, v: i64) -> i64
called by 1: nx_wiki_graph_render_svg calls 1: sys_mmap
270func nx_wiki_graph_render_svg(store: *NxWikiGraph, doc_store: *NxWikiDocStore,