pub struct Hypergraph {
pub n_vertices: usize,
pub n_hyperedges: usize,
pub incidence_matrix: Array2<Float>,
pub hyperedge_weights: Array1<Float>,
pub vertex_weights: Array1<Float>,
pub hyperedge_sizes: Array1<usize>,
pub communities: Option<Array1<usize>>,
}Expand description
Hypergraph structure representation
Fields§
§n_vertices: usizeNumber of vertices
n_hyperedges: usizeNumber of hyperedges
incidence_matrix: Array2<Float>Incidence matrix: vertices × hyperedges H[i,e] = 1 if vertex i is in hyperedge e, 0 otherwise
hyperedge_weights: Array1<Float>Hyperedge weights
vertex_weights: Array1<Float>Vertex weights (degrees)
hyperedge_sizes: Array1<usize>Hyperedge size distribution
communities: Option<Array1<usize>>Optional clustering/community information
Implementations§
Source§impl Hypergraph
impl Hypergraph
Sourcepub fn new(incidence_matrix: Array2<Float>) -> Result<Self, SklearsError>
pub fn new(incidence_matrix: Array2<Float>) -> Result<Self, SklearsError>
Create a new hypergraph from incidence matrix
Sourcepub fn from_hyperedges(
n_vertices: usize,
hyperedges: &[Vec<usize>],
) -> Result<Self, SklearsError>
pub fn from_hyperedges( n_vertices: usize, hyperedges: &[Vec<usize>], ) -> Result<Self, SklearsError>
Create a hypergraph from a list of hyperedges
Sourcepub fn with_hyperedge_weights(
self,
weights: Array1<Float>,
) -> Result<Self, SklearsError>
pub fn with_hyperedge_weights( self, weights: Array1<Float>, ) -> Result<Self, SklearsError>
Set hyperedge weights
Sourcepub fn with_communities(
self,
communities: Array1<usize>,
) -> Result<Self, SklearsError>
pub fn with_communities( self, communities: Array1<usize>, ) -> Result<Self, SklearsError>
Set community assignments
Sourcepub fn compute_laplacian(
&self,
variant: HypergraphLaplacianType,
) -> Array2<Float>
pub fn compute_laplacian( &self, variant: HypergraphLaplacianType, ) -> Array2<Float>
Compute the hypergraph Laplacian matrix
Sourcepub fn detect_communities(
&mut self,
n_communities: usize,
) -> Result<Array1<usize>, SklearsError>
pub fn detect_communities( &mut self, n_communities: usize, ) -> Result<Array1<usize>, SklearsError>
Detect communities using spectral clustering on the hypergraph
Sourcepub fn compute_centrality(&self) -> HypergraphCentrality
pub fn compute_centrality(&self) -> HypergraphCentrality
Compute hypergraph centrality measures
Trait Implementations§
Source§impl Clone for Hypergraph
impl Clone for Hypergraph
Source§fn clone(&self) -> Hypergraph
fn clone(&self) -> Hypergraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Hypergraph
impl RefUnwindSafe for Hypergraph
impl Send for Hypergraph
impl Sync for Hypergraph
impl Unpin for Hypergraph
impl UnwindSafe for Hypergraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more