The pixel neighborhood graph is reconstructed in Rust with petgraph from width/height/neighbors (no adjacency matrix crosses the FFI boundary), the combinatorial Laplacian L = D - W is assembled directly in CSC form, and the linear system (I + alpha * L) x = b is solved band-by-band with an iterative Krylov solver: Conjugate Gradient ("cg", the default – the operator is symmetric positive-definite) or BiCGSTAB ("bicgstab").

graph_smooth_rust(data, width, height, alpha, neighbors, solver)

Arguments

data

RMatrix of input spectra data.

width

width of the image.

height

height of the image.

alpha

smoothing parameter.

neighbors

connection type (4 or 8).

solver

iterative method, "cg" or "bicgstab".