pub struct GraphEmbedder;Expand description
Graph embedding engine: Node2Vec-inspired random walks and structural embeddings
Implementations§
Source§impl GraphEmbedder
impl GraphEmbedder
Sourcepub fn random_walks(graph: &Graph, config: &WalkConfig) -> Vec<Vec<usize>>
pub fn random_walks(graph: &Graph, config: &WalkConfig) -> Vec<Vec<usize>>
Generate biased random walks for all nodes.
Uses Node2Vec-style second-order biased walks governed by p and q. When p=1 and q=1 the walk degenerates to a uniform random walk (DeepWalk).
Returns a list of walks, each being a sequence of node IDs.
Sourcepub fn embed(graph: &Graph, config: &WalkConfig, dim: usize) -> EmbeddingResult
pub fn embed(graph: &Graph, config: &WalkConfig, dim: usize) -> EmbeddingResult
Generate random-walk-based embeddings.
Each node’s embedding is derived from its walk co-occurrence profile (simplified: averaged node-ID features from walk context).
Sourcepub fn structural_embedding(graph: &Graph, dim: usize) -> Vec<NodeEmbedding>
pub fn structural_embedding(graph: &Graph, dim: usize) -> Vec<NodeEmbedding>
Compute structural embeddings based purely on local neighborhood topology.
Each node’s embedding aggregates neighbour degree statistics projected into dim.
Sourcepub fn node_similarity(a: &NodeEmbedding, b: &NodeEmbedding) -> f32
pub fn node_similarity(a: &NodeEmbedding, b: &NodeEmbedding) -> f32
Cosine similarity between two node embeddings, in range [-1, 1].
Auto Trait Implementations§
impl Freeze for GraphEmbedder
impl RefUnwindSafe for GraphEmbedder
impl Send for GraphEmbedder
impl Sync for GraphEmbedder
impl Unpin for GraphEmbedder
impl UnsafeUnpin for GraphEmbedder
impl UnwindSafe for GraphEmbedder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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