Chapter 12
Temporal and comparative analysis
Hypergraphs change: teams form and dissolve, news narratives rise and fade, and production systems are redesigned. This chapter treats a hypergraph with time stamps as a sequence of snapshots and measures how the groups turn over, which combinations persist, how the activity of vertices shifts, and how frequent patterns differ between periods. The same tools compare two versions of a system: a difference hypergraph marks what was kept, removed, and added, group statistics compare the composition of the work, and distances between hypergraphs summarize the change in one number. The examples follow the narratives of the synthetic news data and the redesign of the production system of HyperGodot.
12.1 Problem and idea
A static hypergraph aggregates all groups regardless of when they occurred. For many questions the timing is the point. A narrative that dominates the coverage of one year and disappears the next, a team that keeps reforming with the same core, or a production step that was removed in a redesign cannot be seen in the aggregate. Temporal properties of group interactions differ systematically from those of pairs: Cencetti et al. [155] found, in face-to-face contact data, that larger groups are shorter-lived and that group composition changes in characteristic ways that pairwise contact networks do not capture.
The idea of this chapter is to keep the time stamp as an attribute of every hyperedge and to derive from it three kinds of objects (fig. 12.1): snapshots, the hypergraphs of the hyperedges in one period, to which every static method applies; transitions between consecutive snapshots, measured by turnover and persistence; and differences between two hypergraphs, marked hyperedge by hyperedge. The PAOH view of section 3.2.6 and the group-tagged drawings of section 4.2.5 are the visual counterparts.
12.2 Theory
12.2.1 Snapshots and windows
A temporal hypergraph assigns a time stamp (a number, a date, or an ordered label such as a year) to every hyperedge; a repeated group at a different time is a separate hyperedge. The snapshot at time is the partial hypergraph and the window is ; keeping the full vertex set makes the snapshots directly comparable. Any measure of the previous chapters can be computed per snapshot, giving a time series per vertex (degree, centrality) or per pattern (support). The aggregate hypergraph merges repeated vertex sets over time and adds their weights.
12.2.2 Turnover and persistence
Let be the set of distinct vertex sets that occur as hyperedges in snapshot . Between consecutive snapshots, the new groups are , the persisting groups , and the dropped groups ; the Jaccard similarity
|
| (12.1) |
summarizes the stability of the group repertoire. For every distinct vertex set, its persistence is the number of time stamps in which it occurs, with its first and last occurrence. Groups that persist across all periods are the stable core of a system; groups that occur once are transient. The temporal random model of section 9.2.1, in which a fraction of the hyperedges of each step is copied from the previous one, provides a null model for these quantities.
12.2.3 Patterns over time
Frequent itemsets mined per snapshot (chapter 8) show which combinations dominate each period; comparing their supports shows which combinations grow or decline. Because the support is relative to the snapshot, a combination can become more frequent in relative terms even when the number of hyperedges changes. For planted or labeled data the share of hyperedges with a given label per period (here, the share of articles that carry a given narrative) is the corresponding ground-truth series.
12.2.4 Comparing two hypergraphs
Two versions of a system, before and after a redesign, are compared hyperedge by hyperedge: the difference hypergraph is the union of both, with every hyperedge marked as present in both versions, only in the first, or only in the second, where hyperedges are matched by their vertex sets. Drawn with the status as the group tag (section 4.2.5), it shows at a glance what was kept, removed, and added. Group statistics per version (number, total weight, and mean size of the hyperedges per tag, the vertices involved, the most involved vertex) quantify how the composition of the work changes, for example between human and machine tasks.
A single number for the size of the change is given by a distance between hypergraphs. hatvis provides four that look at different levels: the Jaccard distance of the sets of hyperedges (which hyperedges changed), the normalized Hamming distance of the clique-expansion adjacency patterns on the union of the vertex sets (which pairs changed), the Euclidean distance of the sorted spectra of the normalized Laplacians (how the global connectivity changed), and the distance of the normalized degree distributions (how the load on the vertices changed). Surana, Chen, and Rajapakse [19] develop a framework of hypergraph similarity measures based on graph and tensor representations, and Felippe, Kirkley, and Battiston [84] an information-theoretic one that corrects for spurious correspondences.
In a nutshell: Temporal and comparative analysis
- Snapshots and windows are partial hypergraphs on the full vertex set; every static method applies per period.
- Turnover between consecutive snapshots: new, persisting, and dropped vertex sets and their Jaccard similarity (12.1); persistence and lifetime of every group.
- Frequent patterns per period and their changing supports.
- Difference hypergraph (both / only first / only second), group statistics per tag, and distances between hypergraphs (Jaccard on hyperedges, Hamming on pairs, spectral, degree).
12.3 Using it in hatvis
TemporalHypergraph(edges, times, **kwargs)
- Methods
-
times, at(t), window(start, stop), snapshots(), aggregate(how), TemporalHypergraph.from_hypergraph(H, time_attr).
- Related
-
temporal.turnover(T), temporal.persistence(T), temporal.temporal_centrality(T, func), temporal.difference(H1, H2, labels), temporal.group_statistics(H, group, weight_name), similarity.hypergraph_distance(H1, H2, kind); plots plot_paoh(T, time="time"), plot_activity(T).
12.4 Examples
Evolving narratives. The synthetic news hypergraph with 150 articles per period (section 3.4) is analyzed period by period.
print(hv.temporal.turnover(T)) print(hv.temporal.persistence(T).head(5).to_string()) top = {t: hv.frequent_itemsets(S, min_support=0.08, min_size=2).head(3) for t, S in T.snapshots().items()}
The repertoire of theme combinations is volatile: from 2021 to 2022, 94 combinations are new, 29 persist, and 86 are dropped (Jaccard similarity 0.139); from 2022 to 2023 the numbers are 90, 26, and 97 (0.122). Most articles use a combination that occurs in one period only, which is expected when articles draw random subsets of their narratives. The persistent combinations are the stable cores: the four-theme sets of the climate-science, impacts, and society narratives occur in all three periods, as do two large combinations that join finance and loss-and-damage with the impacts or the policy themes. The most frequent pairs of each period trace the planted trends. In 2021 they come from climate science, energy, and policy (emissions–temperature, coal–oil_gas, agreement–pledge); in 2022 all three come from climate science; in 2023 all three come from the finance narrative (developing–loss_damage, aid–loss_damage, developing–finance). The ground truth confirms the shift: the share of articles that carry the finance narrative grows from 0.10 to 0.19 and 0.34. The activity plot of fig. 12.2 shows the same at the level of single themes: the finance and loss-and-damage themes grow from period to period while the energy themes decline.
Open in ColabExample plot_38_evolving_narratives.py in the gallery
Comparing two versions of a production system. The HyperGodot case study [2] suggested two changes to the production example: dropping the final inspection , which duplicates the automated quality control , and automating the manual assembly . The redesigned system replaces by a robotic assembly performed by a new robot on the same components in 18 minutes (an illustrative time).
after = before.remove_edges(["E7", "E5"]).add_edges({"E5r": ["R3", "C2", "C3", "C4", "FP"]}, weights=[18]) after.edge_data.loc["E5r", ["task", "group"]] = ["Robotic assembly", "M"] diff = hv.temporal.difference(before, after, labels=("before", "after")) stats = pd.concat({"before": hv.temporal.group_statistics(before, weight_name="minutes"), "after": hv.temporal.group_statistics(after, weight_name="minutes")})
Five tasks are kept, two are removed ( and ), and one is added (). The human group shrinks from five tasks with 85 minutes to three tasks with 40 minutes, while the machine group grows from two tasks with 45 minutes to three with 63 minutes. The difference hypergraph of fig. 12.3 draws the kept tasks solid and the removed and added ones dashed and dotted; the robotic assembly takes the place of the manual one at the junction of the components. The operator takes part only in the two removed tasks, so the redesign frees this operator entirely.
dist = {kind: hv.similarity.hypergraph_distance(before, after, kind) for kind in ("jaccard", "hamming", "spectral", "degree")}
The four distances describe the redesign at four levels. The Jaccard distance of the hyperedge sets is 0.375 (three of eight distinct tasks changed), the Hamming distance of the pairwise adjacencies only 0.067 (most pairs of entities still work together, because the new task joins the same components), the spectral distance 0.094, and the degree distance 0.258, reflecting that the load moves from the worker to the new robot.
Open in ColabExample plot_39_comparing_systems.py in the gallery
12.5 Further reading
Valdivia et al. [53] design the PAOH view for dynamic hypergraphs and evaluate it with historians and social scientists. Cencetti et al. [155] analyze the temporal properties of group interactions in social data. Surana, Chen, and Rajapakse [19] and Felippe, Kirkley, and Battiston [84] develop measures for comparing hypergraphs. Fischer et al. [31] survey static and dynamic hypergraph visualizations.