pub struct GraphAdjacencyIndex { /* private fields */ }Expand description
Graph adjacency index for fast edge/neighbor lookups
Supports O(1) lookups for:
- All outgoing edges from a node
- All incoming edges to a node
- Edges filtered by label
Implementations§
Source§impl GraphAdjacencyIndex
impl GraphAdjacencyIndex
Sourcepub fn new() -> GraphAdjacencyIndex
pub fn new() -> GraphAdjacencyIndex
Create a new empty adjacency index
Sourcepub fn index_edge(
&self,
edge_id: EntityId,
source_id: EntityId,
target_id: EntityId,
label: &str,
weight: f32,
)
pub fn index_edge( &self, edge_id: EntityId, source_id: EntityId, target_id: EntityId, label: &str, weight: f32, )
Index an edge for fast lookups
Sourcepub fn remove_edge(&self, edge_id: EntityId)
pub fn remove_edge(&self, edge_id: EntityId)
Remove an edge from the index
Sourcepub fn get_neighbors(
&self,
node_id: EntityId,
direction: EdgeDirection,
label_filter: Option<&str>,
) -> Vec<AdjacencyEntry>
pub fn get_neighbors( &self, node_id: EntityId, direction: EdgeDirection, label_filter: Option<&str>, ) -> Vec<AdjacencyEntry>
Get neighbors in a direction (optionally filtered by label)
Sourcepub fn get_edges_by_label(&self, label: &str) -> Vec<EntityId>
pub fn get_edges_by_label(&self, label: &str) -> Vec<EntityId>
Get all edges with a specific label
Sourcepub fn out_degree(&self, node_id: EntityId) -> usize
pub fn out_degree(&self, node_id: EntityId) -> usize
Get outgoing degree of a node
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Get edge count
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get node count
Trait Implementations§
Source§impl Default for GraphAdjacencyIndex
impl Default for GraphAdjacencyIndex
Source§fn default() -> GraphAdjacencyIndex
fn default() -> GraphAdjacencyIndex
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for GraphAdjacencyIndex
impl !RefUnwindSafe for GraphAdjacencyIndex
impl Send for GraphAdjacencyIndex
impl Sync for GraphAdjacencyIndex
impl Unpin for GraphAdjacencyIndex
impl UnsafeUnpin for GraphAdjacencyIndex
impl UnwindSafe for GraphAdjacencyIndex
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request