pub struct PetTemporalGraph<N, L, V, T> { /* private fields */ }Expand description
A temporal graph backed by petgraph::StableGraph.
Nodes are identified by N, edges carry TemporalEdge<L, V, T>.
A HashMap<N, NodeIndex> provides reverse lookup from user IDs to
petgraph’s internal NodeIndex.
Implementations§
Source§impl<N, L, V, T> PetTemporalGraph<N, L, V, T>
impl<N, L, V, T> PetTemporalGraph<N, L, V, T>
Sourcepub fn add_node(&mut self, id: N) -> NodeIndex
pub fn add_node(&mut self, id: N) -> NodeIndex
Add a node (or return existing index if already present).
Sourcepub fn add_edge(&mut self, from: N, label: L, value: V, interval: Interval<T>)
pub fn add_edge(&mut self, from: N, label: L, value: V, interval: Interval<T>)
Add a temporal edge between two nodes.
Sourcepub fn add_edge_to_node(
&mut self,
from: N,
label: L,
to: N,
interval: Interval<T>,
)
pub fn add_edge_to_node( &mut self, from: N, label: L, to: N, interval: Interval<T>, )
Add a temporal edge with a node-valued target (also ensures target node exists).
Sourcepub fn add_edge_bounded(
&mut self,
from: N,
label: L,
value: V,
start: T,
end: T,
)where
T: Ord,
pub fn add_edge_bounded(
&mut self,
from: N,
label: L,
value: V,
start: T,
end: T,
)where
T: Ord,
Add a temporal edge with a bounded interval [start, end).
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes.
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
Number of edges.
Trait Implementations§
Source§impl<N, L, T> DataSource for PetTemporalGraph<N, L, PetValue<N>, T>
impl<N, L, T> DataSource for PetTemporalGraph<N, L, PetValue<N>, T>
Source§fn scan(
&self,
label: &L,
constraint: &ValueConstraint<PetValue<N>>,
at: &T,
) -> Vec<Edge<N, PetValue<N>, T>>
fn scan( &self, label: &L, constraint: &ValueConstraint<PetValue<N>>, at: &T, ) -> Vec<Edge<N, PetValue<N>, T>>
Find all source nodes that have an edge with
label matching constraint,
active at time at. Read moreSource§fn edges_from_any_time(
&self,
node: &N,
label: &L,
) -> Vec<Edge<N, PetValue<N>, T>>
fn edges_from_any_time( &self, node: &N, label: &L, ) -> Vec<Edge<N, PetValue<N>, T>>
Find all edges from
node with label that were ever valid
(regardless of time). Used for temporal constraint checking.Source§fn scan_any_time(
&self,
label: &L,
constraint: &ValueConstraint<PetValue<N>>,
) -> Vec<Edge<N, PetValue<N>, T>>
fn scan_any_time( &self, label: &L, constraint: &ValueConstraint<PetValue<N>>, ) -> Vec<Edge<N, PetValue<N>, T>>
Scan for edges with
label matching constraint at any time.Source§fn value_as_node(&self, value: &PetValue<N>) -> Option<N>
fn value_as_node(&self, value: &PetValue<N>) -> Option<N>
Check if a value represents a node reference (for traversal)
vs. a literal (for comparison). This lets the pattern matcher
know whether to follow a value as a node or compare it as data.
Auto Trait Implementations§
impl<N, L, V, T> Freeze for PetTemporalGraph<N, L, V, T>where
T: Freeze,
impl<N, L, V, T> RefUnwindSafe for PetTemporalGraph<N, L, V, T>
impl<N, L, V, T> Send for PetTemporalGraph<N, L, V, T>
impl<N, L, V, T> Sync for PetTemporalGraph<N, L, V, T>
impl<N, L, V, T> Unpin for PetTemporalGraph<N, L, V, T>
impl<N, L, V, T> UnsafeUnpin for PetTemporalGraph<N, L, V, T>where
T: UnsafeUnpin,
impl<N, L, V, T> UnwindSafe for PetTemporalGraph<N, L, V, T>
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