pub struct Node2VecEmbedder { /* private fields */ }Expand description
Node2Vec graph embedding generator.
§Example
ⓘ
use oxirs_graphrag::{Triple, embeddings::node2vec::{Node2VecConfig, Node2VecEmbedder}};
let triples = vec![
Triple::new("a", "knows", "b"),
Triple::new("b", "knows", "c"),
];
let embedder = Node2VecEmbedder::new(Node2VecConfig::default());
let embs = embedder.embed(&triples)?;
println!("a→b similarity: {:?}", embs.cosine_similarity("a", "b"));Implementations§
Source§impl Node2VecEmbedder
impl Node2VecEmbedder
Sourcepub fn new(config: Node2VecConfig) -> Self
pub fn new(config: Node2VecConfig) -> Self
Create a new embedder with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a new embedder with default configuration.
Sourcepub fn embed(&self, triples: &[Triple]) -> GraphRAGResult<Node2VecEmbeddings>
pub fn embed(&self, triples: &[Triple]) -> GraphRAGResult<Node2VecEmbeddings>
Build embeddings for all nodes reachable via triples.
Auto Trait Implementations§
impl Freeze for Node2VecEmbedder
impl RefUnwindSafe for Node2VecEmbedder
impl Send for Node2VecEmbedder
impl Sync for Node2VecEmbedder
impl Unpin for Node2VecEmbedder
impl UnsafeUnpin for Node2VecEmbedder
impl UnwindSafe for Node2VecEmbedder
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