pub struct SpectralEmbedding<N: Node> { /* private fields */ }Expand description
Spectral embedding of a graph
Computes a low-dimensional embedding by finding the smallest eigenvectors of the graph Laplacian matrix using the power iteration / inverse iteration method.
Implementations§
Source§impl<N: Node + Debug> SpectralEmbedding<N>
impl<N: Node + Debug> SpectralEmbedding<N>
Sourcepub fn new(config: SpectralEmbeddingConfig) -> Self
pub fn new(config: SpectralEmbeddingConfig) -> Self
Create a new spectral embedding with the given configuration
Sourcepub fn fit<E, Ix>(&mut self, graph: &Graph<N, E, Ix>) -> Result<()>
pub fn fit<E, Ix>(&mut self, graph: &Graph<N, E, Ix>) -> Result<()>
Fit the spectral embedding to a graph
Sourcepub fn get_embedding(&self, node: &N) -> Result<Embedding>
pub fn get_embedding(&self, node: &N) -> Result<Embedding>
Get the embedding for a specific node
Sourcepub fn embeddings(&self) -> Result<HashMap<N, Embedding>>where
N: Clone,
pub fn embeddings(&self) -> Result<HashMap<N, Embedding>>where
N: Clone,
Get all embeddings as a HashMap
Sourcepub fn embedding_matrix(&self) -> Result<&Array2<f64>>
pub fn embedding_matrix(&self) -> Result<&Array2<f64>>
Get the embedding matrix (n x d)
Sourcepub fn eigenvalues(&self) -> Result<&Array1<f64>>
pub fn eigenvalues(&self) -> Result<&Array1<f64>>
Get the eigenvalues corresponding to the embedding dimensions
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Get the embedding dimension
Sourcepub fn pairwise_distances(&self) -> Result<Array2<f64>>
pub fn pairwise_distances(&self) -> Result<Array2<f64>>
Compute pairwise distances between all embedded nodes
Auto Trait Implementations§
impl<N> Freeze for SpectralEmbedding<N>
impl<N> RefUnwindSafe for SpectralEmbedding<N>where
N: RefUnwindSafe,
impl<N> Send for SpectralEmbedding<N>
impl<N> Sync for SpectralEmbedding<N>
impl<N> Unpin for SpectralEmbedding<N>where
N: Unpin,
impl<N> UnsafeUnpin for SpectralEmbedding<N>
impl<N> UnwindSafe for SpectralEmbedding<N>where
N: UnwindSafe,
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> 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