pub struct GraphIndex { /* private fields */ }Expand description
Dense, reusable indexes over a Graph.
This is backend-neutral: it validates edge endpoints, maps node ids to stable vertex indexes, and stores edge adjacency by both node id and vertex index. Higher-level crates can use it for local analytics or query planning without rebuilding the same maps.
Implementations§
Source§impl GraphIndex
impl GraphIndex
pub fn new(graph: &Graph) -> Result<Self>
pub fn vertex_index(&self, id: &NodeId) -> Option<usize>
pub fn require_vertex_index(&self, id: &NodeId) -> Result<usize>
pub fn outgoing_edges(&self, id: &NodeId) -> &[usize]
pub fn incoming_edges(&self, id: &NodeId) -> &[usize]
pub fn outgoing_by_vertex(&self, index: usize) -> &[usize]
pub fn incoming_by_vertex(&self, index: usize) -> &[usize]
pub fn edge_endpoints(&self, edge_index: usize) -> (usize, usize)
pub fn edge_endpoints_slice(&self) -> &[(usize, usize)]
pub fn out_degree(&self, index: usize) -> usize
pub fn in_degree(&self, index: usize) -> usize
pub fn degree(&self, index: usize) -> usize
Trait Implementations§
Source§impl Clone for GraphIndex
impl Clone for GraphIndex
Source§fn clone(&self) -> GraphIndex
fn clone(&self) -> GraphIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GraphIndex
impl Debug for GraphIndex
Source§impl PartialEq for GraphIndex
impl PartialEq for GraphIndex
Source§fn eq(&self, other: &GraphIndex) -> bool
fn eq(&self, other: &GraphIndex) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for GraphIndex
Auto Trait Implementations§
impl Freeze for GraphIndex
impl RefUnwindSafe for GraphIndex
impl Send for GraphIndex
impl Sync for GraphIndex
impl Unpin for GraphIndex
impl UnsafeUnpin for GraphIndex
impl UnwindSafe for GraphIndex
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