mod hypergraph_matrix;
mod laplacian;
pub use hypergraph_matrix::{
adjacency_matrix, clique_motif_matrix, degree_matrix, incidence_matrix,
incidence_matrix_sparse, intersection_profile,
};
pub use laplacian::{laplacian, multiorder_laplacian, normalized_hypergraph_laplacian};
use crate::Hypergraph;
use thiserror::Error;
#[derive(Debug, Clone, Error, PartialEq)]
pub enum LinalgError {
#[error("every node must be a member of an edge to avoid divide-by-zero")]
IsolatedNodes,
}
pub(crate) fn filtered_edge_ids<N, E, M>(
h: &Hypergraph<N, E, M>,
order: Option<usize>,
) -> Vec<String> {
match order {
None => h.edge_ids(),
Some(d) => h
.edge_ids()
.into_iter()
.filter(|e| h.members(e).map(|m| m.len()) == Some(d + 1))
.collect(),
}
}