pub struct HypergraphIndex { /* private fields */ }Expand description
Hypergraph index with bipartite graph storage
Implementations§
Source§impl HypergraphIndex
impl HypergraphIndex
Sourcepub fn new(distance_metric: DistanceMetric) -> Self
pub fn new(distance_metric: DistanceMetric) -> Self
Create a new hypergraph index
Sourcepub fn add_entity(&mut self, id: VectorId, embedding: Vec<f32>)
pub fn add_entity(&mut self, id: VectorId, embedding: Vec<f32>)
Add an entity node
Sourcepub fn add_hyperedge(&mut self, hyperedge: Hyperedge) -> Result<()>
pub fn add_hyperedge(&mut self, hyperedge: Hyperedge) -> Result<()>
Add a hyperedge
Sourcepub fn add_temporal_hyperedge(
&mut self,
temporal_edge: TemporalHyperedge,
) -> Result<()>
pub fn add_temporal_hyperedge( &mut self, temporal_edge: TemporalHyperedge, ) -> Result<()>
Add a temporal hyperedge
Sourcepub fn search_hyperedges(
&self,
query_embedding: &[f32],
k: usize,
) -> Vec<(String, f32)>
pub fn search_hyperedges( &self, query_embedding: &[f32], k: usize, ) -> Vec<(String, f32)>
Search hyperedges by embedding similarity
Sourcepub fn k_hop_neighbors(
&self,
start_node: VectorId,
k: usize,
) -> HashSet<VectorId>
pub fn k_hop_neighbors( &self, start_node: VectorId, k: usize, ) -> HashSet<VectorId>
Get k-hop neighbors in hypergraph Returns all nodes reachable within k hops from the start node
Sourcepub fn query_temporal_range(
&self,
start_bucket: u64,
end_bucket: u64,
) -> Vec<String>
pub fn query_temporal_range( &self, start_bucket: u64, end_bucket: u64, ) -> Vec<String>
Query temporal hyperedges in a time range
Sourcepub fn get_hyperedge(&self, id: &str) -> Option<&Hyperedge>
pub fn get_hyperedge(&self, id: &str) -> Option<&Hyperedge>
Get hyperedge by ID
Sourcepub fn stats(&self) -> HypergraphStats
pub fn stats(&self) -> HypergraphStats
Get statistics
Auto Trait Implementations§
impl Freeze for HypergraphIndex
impl RefUnwindSafe for HypergraphIndex
impl Send for HypergraphIndex
impl Sync for HypergraphIndex
impl Unpin for HypergraphIndex
impl UnwindSafe for HypergraphIndex
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