| Crates.io | lapl |
| lib.rs | lapl |
| version | 0.1.0 |
| created_at | 2026-01-18 15:17:44.324396+00 |
| updated_at | 2026-01-18 15:17:44.324396+00 |
| description | Spectral methods: graph Laplacian, eigenmaps, spectral clustering |
| homepage | https://github.com/arclabs561/lapl |
| repository | https://github.com/arclabs561/lapl |
| max_upload_size | |
| id | 2052474 |
| size | 104,997 |
Spectral graph theory primitives for manifold learning and connectivity analysis. Implements graph Laplacians (unnormalized, symmetric, random walk) and spectral embeddings.
Dual-licensed under MIT or Apache-2.0.
use lapl::{adjacency_to_laplacian, normalized_laplacian, gaussian_similarity};
use ndarray::array;
// Simple graph: 0 -- 1 -- 2
let adj = array![
[0.0, 1.0, 0.0],
[1.0, 0.0, 1.0],
[0.0, 1.0, 0.0]
];
let lap = adjacency_to_laplacian(&adj); // L = D - A
let lap_norm = normalized_laplacian(&adj); // L_sym = I - D^{-1/2} A D^{-1/2}
| Function | Purpose |
|---|---|
adjacency_to_laplacian |
Unnormalized L = D - A |
normalized_laplacian |
Symmetric normalized (diagonal=1 for isolated nodes) |
normalized_laplacian_checked |
Rejects graphs with isolated nodes |
random_walk_laplacian |
L_rw = I - D^{-1} A |
transition_matrix |
Random walk P = D^{-1} A |
gaussian_similarity |
RBF kernel similarity |
knn_graph |
k-nearest neighbor graph |
epsilon_graph |
Epsilon-neighborhood |
is_connected |
Check connectivity |
laplacian_quadratic_form |
x^T L x |