pub struct LinkStream {
pub edges: Vec<TemporalEdge>,
pub nodes: Vec<usize>,
pub time_start: f64,
pub time_end: f64,
}Expand description
A continuous-time temporal network represented as a link stream.
Fields§
§edges: Vec<TemporalEdge>All temporal edges in the stream.
nodes: Vec<usize>All node identifiers present in the stream.
time_start: f64Start of the observation window.
time_end: f64End of the observation window.
Implementations§
Source§impl LinkStream
impl LinkStream
Sourcepub fn new(time_start: f64, time_end: f64) -> Self
pub fn new(time_start: f64, time_end: f64) -> Self
Create an empty link stream over the interval [time_start, time_end].
Sourcepub fn add_edge(&mut self, src: usize, dst: usize, start: f64, end: f64)
pub fn add_edge(&mut self, src: usize, dst: usize, start: f64, end: f64)
Add a temporal edge; both endpoints are registered as nodes if absent.
Sourcepub fn average_degree(&self, u: usize, n_samples: usize) -> f64
pub fn average_degree(&self, u: usize, n_samples: usize) -> f64
Time-averaged degree of node u, estimated by uniform sampling.
n_samples controls accuracy; higher values reduce discretisation error.
Sourcepub fn contact_duration(&self, u: usize, v: usize) -> f64
pub fn contact_duration(&self, u: usize, v: usize) -> f64
Total contact time between nodes u and v.
Sourcepub fn inter_contact_times(&self, u: usize, v: usize) -> Vec<f64>
pub fn inter_contact_times(&self, u: usize, v: usize) -> Vec<f64>
Vector of gap durations between successive contacts of u and v.
Contacts are sorted by start time; the gap is the time between the end of one contact and the start of the next. Negative gaps (overlapping contacts) are excluded.
Sourcepub fn clustering_coefficient_at(&self, u: usize, t: f64) -> f64
pub fn clustering_coefficient_at(&self, u: usize, t: f64) -> f64
Local temporal clustering coefficient of node u at time t.
Defined as the fraction of pairs among u’s neighbours that are
themselves connected at time t.
Sourcepub fn total_interaction_time(&self) -> f64
pub fn total_interaction_time(&self) -> f64
Sum of all edge durations.
Sourcepub fn stream_density(&self) -> f64
pub fn stream_density(&self) -> f64
Stream density: fraction of (node-pair × time) space that is active.
Defined as total_interaction_time / (|V|*(|V|-1)/2 * T) for undirected streams.
Auto Trait Implementations§
impl Freeze for LinkStream
impl RefUnwindSafe for LinkStream
impl Send for LinkStream
impl Sync for LinkStream
impl Unpin for LinkStream
impl UnsafeUnpin for LinkStream
impl UnwindSafe for LinkStream
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> 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