This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Commit e6505c0
committed
feat: add SpectralAnalyzer — eigenvalue-based graph analysis
Computes adjacency and Laplacian matrix spectra using the Jacobi
eigenvalue algorithm (no external linear algebra dependencies).
Capabilities:
- Adjacency & Laplacian eigenvalues (full spectrum)
- Spectral radius (largest adjacency eigenvalue)
- Spectral gap (expansion quality indicator)
- Algebraic connectivity / Fiedler value (robustness measure)
- Fiedler vector + spectral bisection (graph partitioning)
- Graph energy (sum of |eigenvalues|)
- Spanning tree count (Kirchhoff's theorem)
- Bipartite detection (spectral symmetry test)
- Classification (connected/disconnected, regular, expander quality)
- toMap() for JSON export, getSummary() for text report
Usage:
SpectralAnalyzer sa = new SpectralAnalyzer(graph).compute();
System.out.println(sa.getSummary());
double lambda2 = sa.getAlgebraicConnectivity();
List<String> groupA = sa.getPartitionA();
Includes 33 tests covering empty/trivial/K2/K3/K4/K5, paths, cycles,
stars, disconnected graphs, barbell partitioning, eigenvalue properties
(non-negative Laplacian, trace=0 for adjacency), defensive copies.
All 822 tests pass.1 parent 7d47ed0 commit e6505c0
2 files changed
Lines changed: 1238 additions & 0 deletions
0 commit comments