nx_graphalg.nx
buildroot/runtime/nx_graphalg.nx
about
nx_graphalg.nx -- graph algorithms (BFS + Dijkstra + topological sort).
Adjacency-list representation with bounded fan-out (max_edges per
vertex). Pure i64. Priority queue via sketch_min_heap.
Sibling of nx_graph.nx (which provides adjacency-MATRIX primitives
for math/theorem use); this module provides adjacency-LIST graph
algorithms for navigation, planning, and dependency resolution.
What this unlocks:
+ shortest-path navigation (Dijkstra, BFS)
+ dependency resolution / build order (topological sort)
+ planning, routing, scheduling
+ control-flow + dataflow + call-graph reasoning
+ state-machine reachability
Representation:
adj_to[u * max_edges + j] : target of u's jth edge
adj_w [u * max_edges + j] : weight of that edge
adj_size[u] : current edge count of u (0..max_edges)
genealogy_id: dijkstra_1959 + kahn_1962_topological + moore_1959_bfs
lineage_id: adjacency_list + priority_queue_dijkstra
dependencies 2 imports · 1 importers
imports: syscalls.nxsketch_min_heap.nx
imported by: nx_graphalg_test.nx
structs
| 36 | struct GraphAdj |
consts
| 34 | const NX_GRAPHALG_INF: i64 = 9000000000000000000 |
functions
| 44 | func nx_graphalg_alloc(n_vertices: i64, max_edges: i64) -> *GraphAdj called by 1: main |
| 59 | func nx_graphalg_add_edge(g: *GraphAdj, u: i64, v: i64, w: i64) -> i64 |
| 69 | func nx_graphalg_add_undirected_edge(g: *GraphAdj, u: i64, v: i64, |
| 76 | func nx_graphalg_neighbor_count(g: *GraphAdj, u: i64) -> i64 |
| 80 | func nx_graphalg_neighbor(g: *GraphAdj, u: i64, j: i64) -> i64 |
| 84 | func nx_graphalg_neighbor_weight(g: *GraphAdj, u: i64, j: i64) -> i64 |
| 90 | func nx_graphalg_bfs(g: *GraphAdj, src: i64, dist_out: *i64) -> i64 |
| 123 | func nx_graphalg_dijkstra(g: *GraphAdj, src: i64, called by 1: main calls 9: nx_heap_allocnx_heap_pushnx_heap_sizenx_heap_peek_keynx_heap_peek_valuenx_heap_pop+3 |
| 161 | func nx_graphalg_toposort(g: *GraphAdj, order_out: *i64) -> i64 |