pub fn von_neumann_entropy(graph: &Graph) -> IgraphResult<f64>Expand description
Approximate Von Neumann entropy of the graph.
The Von Neumann entropy is S = -Σ_i λ_i log2(λ_i) where λ_i are
the eigenvalues of the density matrix ρ = L / trace(L) with L being
the combinatorial Laplacian.
Since trace(L) = 2|E| and eigenvalues sum to trace(L),
we use the quadratic approximation:
S ≈ 1 - (1/|V|) - (1/(2|E|)²) Σ_v deg(v)² (in bits)
This avoids expensive eigendecomposition while capturing the essential structural complexity.
§Examples
use rust_igraph::{Graph, von_neumann_entropy};
// Complete graph has high structural complexity
let k4 = Graph::from_edges(
&[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], false, Some(4)
).unwrap();
let h = von_neumann_entropy(&k4).unwrap();
assert!(h > 0.0);