code wiki / (root) / nx_graphalg.nx

nx_graphalg.nx

buildroot/runtime/nx_graphalg.nx

6424 B210 linesdepth 5pulls 5 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

syscalls.nx sketch_min_heap.nx nx_graphalg.nx nx_graphalg_test.nx

imports: syscalls.nxsketch_min_heap.nx

imported by: nx_graphalg_test.nx

structs

36struct GraphAdj

consts

34const NX_GRAPHALG_INF: i64 = 9000000000000000000

functions

44func nx_graphalg_alloc(n_vertices: i64, max_edges: i64) -> *GraphAdj
called by 1: main
59func nx_graphalg_add_edge(g: *GraphAdj, u: i64, v: i64, w: i64) -> i64
69func nx_graphalg_add_undirected_edge(g: *GraphAdj, u: i64, v: i64,
called by 1: main calls 1: nx_graphalg_add_edge
76func nx_graphalg_neighbor_count(g: *GraphAdj, u: i64) -> i64
80func nx_graphalg_neighbor(g: *GraphAdj, u: i64, j: i64) -> i64
84func nx_graphalg_neighbor_weight(g: *GraphAdj, u: i64, j: i64) -> i64
90func nx_graphalg_bfs(g: *GraphAdj, src: i64, dist_out: *i64) -> i64
123func nx_graphalg_dijkstra(g: *GraphAdj, src: i64,
161func nx_graphalg_toposort(g: *GraphAdj, order_out: *i64) -> i64