pub struct EmbeddingModel<N: Node> {
pub embeddings: HashMap<N, Embedding>,
pub dimensions: usize,
}
Expand description
Graph embedding model
Fields§
§embeddings: HashMap<N, Embedding>
Node embeddings
dimensions: usize
Dimensionality of embeddings
Implementations§
Source§impl<N: Node> EmbeddingModel<N>
impl<N: Node> EmbeddingModel<N>
Sourcepub fn get_embedding(&self, node: &N) -> Option<&Embedding>
pub fn get_embedding(&self, node: &N) -> Option<&Embedding>
Get embedding for a node
Sourcepub fn set_embedding(&mut self, node: N, embedding: Embedding) -> Result<()>
pub fn set_embedding(&mut self, node: N, embedding: Embedding) -> Result<()>
Set embedding for a node
Sourcepub fn initialize_random<E, Ix>(
&mut self,
graph: &Graph<N, E, Ix>,
rng: &mut impl Rng,
)
pub fn initialize_random<E, Ix>( &mut self, graph: &Graph<N, E, Ix>, rng: &mut impl Rng, )
Initialize random embeddings for all nodes
Sourcepub fn initialize_random_digraph<E, Ix>(
&mut self,
graph: &DiGraph<N, E, Ix>,
rng: &mut impl Rng,
)
pub fn initialize_random_digraph<E, Ix>( &mut self, graph: &DiGraph<N, E, Ix>, rng: &mut impl Rng, )
Initialize random embeddings for directed graph
Trait Implementations§
Auto Trait Implementations§
impl<N> Freeze for EmbeddingModel<N>
impl<N> RefUnwindSafe for EmbeddingModel<N>where
N: RefUnwindSafe,
impl<N> Send for EmbeddingModel<N>
impl<N> Sync for EmbeddingModel<N>
impl<N> Unpin for EmbeddingModel<N>where
N: Unpin,
impl<N> UnwindSafe for EmbeddingModel<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