Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/kleene

crates/kleene-graph/README.md

kleene-graph

Graph algorithms written once against kleene-sparse's backend trait, so the same code runs on the CPU and, through kleene-cubecl, on GPUs.

Algorithm Function
Breadth-first search (direction-optimizing, masks) bfs
Propagation to a fixed point propagate
A graph split into parts by a declared key (inner matrix + border, one id space); one part alone from its own rows Split, SplitKey, Split::part_only, Split::part_of_edges
A split computed from the graph (balanced label spreading, up to 64 parts, the same list on every device; the round's pass over the edges on the backend) computed_split, SplitCompute, ComputedSplit, crossing_edges, parts_of_key, GraphBackend::split_votes
Local-first rounds over a split's parts (one part = today's kernel, no exchange) reach_rounds, closure_rounds, components_rounds, sssp_rounds
One sweep in part order (strong components of the part graph; a part outside a circle runs once) reach_sweep, PartOrder
One search over machines that hold the same whole graph, each level cut by edge count into core-weighted slices (one slice = today's kernel); many searches handed out whole search_slices, slice_rounds, ReachSlice, Slices, Found, NodeSet
Many searches from one source each, side by side on the CPU's threads (kept searchers, held to a memory budget) BfsMany
Shortest paths (delta-stepping) sssp, delta_stepping
Set propagation, labelled edges reach_sets, label_reach
Weak components (FastSV, Afforest) components, afforest, afforest_with (kept buffers)
Strong components (Multistep) scc, multistep
PageRank, betweenness, triangles pagerank, betweenness, triangles
Harmonic centrality (exact, 64 searches at once) harmonic
Harmonic centrality estimated (HyperBall) harmonic_estimate
k-truss, truss numbers (peeling) ktruss, truss_numbers
Maximal independent set (rounds, fixed seed) mis
Minimum spanning forest (Borůvka) spanning_forest
Maximum flow (push-relabel on the workers, Dinic to finish) max_flow
Transitive closure closure

Part of kleene.

use kleene_graph::components;
use kleene_sparse::{BoolOrAnd, CpuBackend, CpuDevice, Csr};

// Two weak components: {0, 1, 2} and {3, 4}.
let a = Csr::from_edges(5, 5, &[0, 1, 3], &[1, 2, 4], None, BoolOrAnd)?;
let c = components::<CpuBackend>(&a, &CpuDevice::new(2))?;
assert_eq!(c.count(), 2);
assert_eq!(c.of[0], c.of[2]);
assert_ne!(c.of[0], c.of[3]);
# Ok::<(), Box<dyn std::error::Error>>(())

Licence

MIT or Apache-2.0, at your option.