pub struct TemporalEdgeLayer {
successors: Vec<Option<u32>>,
predecessors: Vec<Option<u32>>,
}Expand description
Temporal edge layer tracking successor/predecessor relationships.
Node IDs must be registered sequentially (0, 1, 2, …).
Fields§
§successors: Vec<Option<u32>>node_id → temporal successor (next point for same entity, or None).
predecessors: Vec<Option<u32>>node_id → temporal predecessor (previous point for same entity, or None).
Implementations§
Source§impl TemporalEdgeLayer
impl TemporalEdgeLayer
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create with pre-allocated capacity.
Sourcepub fn register(&mut self, node_id: u32, entity_last_node: Option<u32>)
pub fn register(&mut self, node_id: u32, entity_last_node: Option<u32>)
Register a new node and link it to the entity’s previous latest node.
entity_last_node should be the node_id of the entity’s most recent
point before this insert (None if this is the entity’s first point).
§Panics
Panics if node_id != self.len() (nodes must be registered sequentially).
Sourcepub fn successor(&self, node_id: u32) -> Option<u32>
pub fn successor(&self, node_id: u32) -> Option<u32>
Get the temporal successor of a node (next point for same entity).
Sourcepub fn predecessor(&self, node_id: u32) -> Option<u32>
pub fn predecessor(&self, node_id: u32) -> Option<u32>
Get the temporal predecessor of a node (previous point for same entity).
Sourcepub fn temporal_neighbors(&self, node_id: u32) -> impl Iterator<Item = u32> + '_
pub fn temporal_neighbors(&self, node_id: u32) -> impl Iterator<Item = u32> + '_
Iterate temporal neighbors (predecessor and/or successor).
Sourcepub fn walk_forward(&self, start: u32, max_steps: usize) -> Vec<u32>
pub fn walk_forward(&self, start: u32, max_steps: usize) -> Vec<u32>
Walk forward in time from a node, returning up to max_steps successors.
Sourcepub fn walk_backward(&self, start: u32, max_steps: usize) -> Vec<u32>
pub fn walk_backward(&self, start: u32, max_steps: usize) -> Vec<u32>
Walk backward in time from a node, returning up to max_steps predecessors.
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Approximate memory usage in bytes.
Trait Implementations§
Source§impl Clone for TemporalEdgeLayer
impl Clone for TemporalEdgeLayer
Source§fn clone(&self) -> TemporalEdgeLayer
fn clone(&self) -> TemporalEdgeLayer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TemporalEdgeLayer
impl Debug for TemporalEdgeLayer
Source§impl Default for TemporalEdgeLayer
impl Default for TemporalEdgeLayer
Source§impl<'de> Deserialize<'de> for TemporalEdgeLayer
impl<'de> Deserialize<'de> for TemporalEdgeLayer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for TemporalEdgeLayer
impl RefUnwindSafe for TemporalEdgeLayer
impl Send for TemporalEdgeLayer
impl Sync for TemporalEdgeLayer
impl Unpin for TemporalEdgeLayer
impl UnwindSafe for TemporalEdgeLayer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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