TSNA.jl
Describe a dynamic network while respecting the order and duration of contacts. TSNA.jl measures snapshot structure, time-respecting reachability, earliest arrival, and the duration and turnover of observed ties.
| First analysis | Learn the model or data | Reference and detail |
|---|---|---|
| Analyse a dynamic network | Understand temporal paths | Choose temporal measures |
Temporal paths describe possible reachability under the implemented contact and waiting rules; they do not predict transmission or causal influence. Analyses reject missing dyads by default (missing=:error); missing=:face explicitly uses stored values. Every snapshot measure uses the actors active at the instant: per-vertex measures return NaN for absent actors, density uses active actors, and reciprocity is the proportion of symmetric dyads (mutual or null) by default; the whole-universe conventions require active_only=false. Activity follows R networkDynamic: an element with no spells is active, adjacent or overlapping spells of an element are one lifetime, and durations and event counts are taken over the observation window with spells clipped to it.
Installation
Use Julia 1.12 or newer and the shared workspace installation guide. These development packages are not yet registered; the guide prepares the required sibling checkouts and a Julia environment for the examples.
Quick Start
A contact at time 1 can be followed by a later contact at time 5, provided the intermediate actor can wait:
using DynamicNetworks, TSNA
dnet = DynamicNetwork(4; observation_start=0.0, observation_end=10.0)
activate_vertices!(dnet, collect(1:4), 0.0, 10.0)
activate!(dnet, 1.0, 4.0; edge=(1, 2))
activate!(dnet, 5.0, 8.0; edge=(2, 3))
elapsed = temporal_distance(dnet, 1, 3, 0.0)
println((elapsed_to_actor3=elapsed, density_at_time2=t_density(dnet, 2.0)))
@assert elapsed == 5.0The temporal distance is elapsed time from the requested start, not a hop count. Actor 2 remains active while waiting. Aggregating both contacts into a static graph would discard the timing condition that makes this route possible.
Choosing Analyses
| Question | Function |
|---|---|
| Who is most central at time t? | t_degree, t_betweenness, t_closeness |
| What is the earliest reachable time? | temporal_distance, forward_reachable_set |
| Who can reach whom? | forward_reachable_set, backward_reachable_set |
| How stable are ties? | t_edge_duration, t_edge_persistence |
| How much turnover is there? | t_turnover, tie_decay |
| How does the network evolve? | t_sna_stats, window_sna_stats |
I know R tsna | Coming from R tsna |
Documentation
- Getting Started
- Temporal Centrality
- Temporal Paths
- Duration Metrics
- Coming from R tsna
- Centrality API Reference
- Paths API Reference
- Metrics API Reference
Theoretical Background
Time-Respecting Paths
In a temporal network, a valid path from $s$ to $r$ starting at time $t_0$ must traverse edges in non-decreasing time order:
\[s = v_0 \xrightarrow{t_1} v_1 \xrightarrow{t_2} v_2 \xrightarrow{t_3} \ldots \xrightarrow{t_k} v_k = r\]
Where $t_0 \leq t_1 \leq t_2 \leq \ldots \leq t_k$ and each edge $(v_{i-1}, v_i)$ is active at time $t_i$.
This constraint means that temporal reachability is not symmetric and not transitive in general.
Temporal Distance
The temporal distance from $s$ to $r$ starting at $t_0$ is the earliest time at which $r$ can be reached:
\[d_T(s, r, t_0) = \min\{t_k : \exists \text{ time-respecting path } s \to r \text{ starting at } t_0 \text{ arriving at } t_k\}\]
temporal_distance reports this as the elapsed time $d_T(s, r, t_0) - t_0$, and returns nothing when no such path exists.
Module Reference
TSNA — Module
TSNA.jl - Temporal Social Network AnalysisTools for analyzing dynamic networks: time-respecting paths and reachability with full interval-spell semantics, temporal centrality measures, duration/turnover metrics, and aggregation.
Time-respecting paths use the interval model: an edge with spell [onset, terminus) can be traversed at any instant t with onset ≤ t < terminus, so a walker may board mid-spell and waiting at a vertex is free. Point spells [t, t) are instantaneous contacts usable exactly at t.
Activity follows R networkDynamic (via DynamicNetworks.jl): an element with no spell record is active (active.default = TRUE) and spells are merged per element. With an observation window (set_observation_period!), durations and event counts are taken over it, with spells clipped to it. Without one, each statistic follows tsna's own rule for a network with no net.obs.period: lifetimes and events over the whole time axis (open spells last Inf), tiedDuration/tEdgeDensity over the range of the change times, event series over the closed range of the change times, and paths without an end. Where tsna would fall back to the placeholder range (0, 1), TSNA raises an ArgumentError asking for a window instead.
Port of the R tsna package from the StatNet collection, with snake_case names; the documentation's R concordance maps each tsna function.
Statistical and path queries reject masked (unobserved) dyads by default. Pass missing=:face explicitly to use the recorded network and spells. Conversions that preserve the missing mask, such as t_aggregate, retain it.
References
Bender-deMoll, S., Morris, M. (2019).
tsna: Tools for Temporal Social Network Analysis. R package.Holme, P. (2015). Modern temporal network theory: a colloquium. European Physical Journal B, 88(9), 1-30.
Holme, P., Saramaki, J. (2012). Temporal networks. Physics Reports, 519(3), 97-125.
Nicosia, V., Tang, J., Mascolo, C., Musolesi, M., Russo, G., Latora, V. (2013). Graph metrics for temporal networks. In Temporal Networks (pp. 15-40). Springer.
Citation
If you use TSNA.jl in your work, please cite it using the entry in CITATION.bib:
@misc{SNWJTSNAJL,
author = {Santoni, Simone},
title = {TSNA.jl: Temporal Social Network Analysis for Julia},
year = {2026},
url = {https://github.com/statistical-network-analysis-with-Julia/TSNA.jl},
note = {Homepage: https://statistical-network-analysis-with-Julia.github.io/TSNA.jl; GitHub: https://github.com/statistical-network-analysis-with-Julia}
}