Mapping change in higher-order networks with multilevel and overlapping communities

New network models of complex systems use layers, state nodes, or hyperedges to capture higher-order interactions and dynamics. Simplifying how the higher-order networks change over time or depending on the network model would be easy with alluvial diagrams, which visualize community splits and merges between networks. However, alluvial diagrams were developed for networks with regular nodes assigned to non-overlapping flat communities. How should they be defined for nodes in layers, state nodes, or hyperedges? How can they depict multilevel, overlapping communities? Here we generalize alluvial diagrams to map change in higher-order networks and provide an interactive tool for anyone to generate alluvial diagrams. We use the alluvial diagram generator in three case studies to illustrate significant changes in the organization of science, the effect of modeling network flows with memory in a citation network and distinguishing multidisciplinary from field-specific journals, and the effects of multilayer representation of a collaboration hypergraph.


INTRODUCTION
Complex systems are inherently dynamic.Their components influence each other through various informational and physical processes, changing interaction patterns over time.Researchers represent these interactions with networks 1,2,3,4,5,6,7 and simplify their organization with community-detection algorithms 8,9,10,11,12 .For example, community-detection algorithms that model the various processes as flows on networks assign nodes to possibly nested modules of typically densely connected nodes, among which the network flows persist relatively long 8 .Identifying modules in multiple networks with shared nodes enables exploring organizational changes when the systems they represent change over time or between states: Modules merge and split when groups in students' social networks form and dissolve during school days, or new research fields emerge when old fields fuse or break and move apart.Various summary statistics can quantify these structural changes 13,14,15 , but they destroy essential information about how the networks change.
Alluvial diagrams with modules represented as stacks of blocks joined by stream fields were introduced to reveal network organizational changes by depicting merg- how we use it in three case studies revealing: significant changes in the multilevel organization of science over six years using parametric bootstrap resampling, multidisciplinary journals in a second-order network representation of citation flows, and the effects of multilayer representation of a collaboration hypergraph.

METHODS
Alluvial diagrams depict changes in the modular composition between networks with stacks of blocks representing the modules (Fig. 1).Each block's height is proportional to the flow volume of the corresponding module -the total visit probability of all nodes in the module.To highlight structural change between multiple networks, a vertical stack of blocks represent each network's modular structure, and horizontal stream fields connect blocks that share nodes across neighboring networks.Like block heights, stream-field heights are proportional to the flow volume of the node overlap between corresponding modules.To reduce clutter, we order stream fields to minimize their overlap.
We use Infomap to search for multilevel modular structures with nested submodules. 28,31Infomap optimizes the map equation, the average per-step codelength on a modular description of a random walk modeling network flows. 8The modules are groups of nodes where the random walker spends a relatively long time compared to exiting it and entering other modules.While we focus on modules derived from Infomap, alluvial diagrams work with output from any community detection or hierarchical data clustering method.

Mapping change in networks with multilevel communities
We extend alluvial diagrams to multilevel network partitions by nesting submodules in super-modules with adaptive module distances.The right multilayer stack of the schematic alluvial diagram in Fig. 1c illustrates.In the spirit of cartography, we put blocks corresponding to the top-level modules in a bottom layer to highlight the large-scale organization and provide a cleaner visualization.Optionally, we display finer-level structures in layers above the bottom layer.The right multilayer stack in Fig. 1c expands the left stack's single layer with one such extra layer corresponding to the four submodules of the multilevel modular solution.To show that deeper submodules are more closely related than their larger parent modules, we draw sibling submodules closer together than other modules.Specifically, we halve the distance between two adjacent modules for each level down in the multilevel solution.

Multilevel significance clustering
To separate trends from mere noise in the module assignments, we extend the significance clustering method described in ref. 16 to multilevel partitions.The approach has three main steps: First, we search for optimal multilevel partitions for each network using Infomap.Then, to assess these partitions' robustness to slight perturbations in the data, we create a large number of independent bootstrap networks.For each bootstrap network, we search for the optimal multilevel partition using Infomap as for the original network.Finally, we summarize the variability in the bootstrap partitions by applying the significance clustering method introduced in ref. 16 extended to multilevel partitions.For each level in the multilevel solution of the original network, we search for the largest subset of nodes in each module or submodule that are also clustered together in at least a fraction p of solutions obtained from the parametric bootstrap procedure.
Searching for significant subsets in multilevel solutions is computationally more demanding than for ordinary two-level partitions.To improve the performance, we trivially parallelize the algorithm by running each module or submodule in separate threads.

Mapping change in higher-order networks
We generalize alluvial diagrams to multilayer and memory networks.Multilayer networks can model different modes of interaction or interactions that change over time in different layers.Memory networks can model dynamics that depend on from where the flows come.Infomap represents both higher-order networks with socalled state nodes. 32In higher-order networks, we call ordinary nodes physical nodes to distinguish them from state nodes.In a multilayer network, one state node for each physical node and layer represents the physical node in the layer. 24In a second-order memory network with memory of the previous step, one state node for each physical node and incoming link represents the physical node for flows incoming along that link. 23Physical nodes with multiple state nodes and different outgoing links can model higher-order dynamics on the network.
In theory, using alluvial diagrams for higher-order networks is no different than for ordinary networks.In practice, the many possible combinations of first-and higherorder networks, memory networks with different memory, and multilayer networks with different layers make it challenging to determine node equality in different networks because we need to match nodes across networks to draw stream fields between modules.While alluvial diagrams require networks to share a significant fraction of physical nodes, we also need their state nodes to match since they are the smallest components of higher- order networks.With no universal solution to this nodematching problem, we discuss some challenges and how we choose to solve them.

First-and higher-order networks
Alluvial diagrams with first-and higher-order networks require matching different node types: First-order networks have only physical nodes, but higher-order networks have physical nodes and state nodes.We illustrate this schematically in Fig. 2 with a first-order network in Fig. 2a and a higher-order network with state nodes as smaller circles inside the physical nodes in Fig. 2c.We consider only hard module boundaries in the first-order network, whereas modules overlap in the higher-order network when physical nodes' state nodes are assigned to different modules.In Fig. 2c, the modules overlap in the physical nodes containing the purple and blue state nodes.
As we need a one-to-one match across networks to draw stream fields, we cannot match all state nodes in the higher-order network to one first-order node.To overcome this problem, we first split the first-order nodes into pseudo-state nodes, which we depict with small dashed circles in Fig. 2a.We create as many pseudo-state nodes as there are state nodes in the matching physical node in the higher-order network.Then, we divide first-order node i's flow volume π (1) i among its pseudo-states α proportionally to their matching state nodes' fraction of the flow π (2) This procedure gives a one-to-one match between nodes in first-and higher-order networks, and we can draw multiple stream fields from a single first-order node (Fig. 2b).

Memory networks
Drawing alluvial diagrams for memory networks requires matching state nodes representing corresponding memory in different networks.We match state nodes across networks by encoding their memory in their ids such that state nodes representing the same memory share the same id in different networks.As long as the networks are not too large, we can encode memory of order n into a single binary number by dividing the binary number into n parts: We divide the number into two parts in a second-order memory network with memory of the previous step.With N physical nodes, we use the b = log 2 N most significant bits of the state id to encode the previously visited node i and the b least significant bits to encode the currently visited node j, resulting in the state id where is the arithmetic left-shift operator and ∨ is the logical or.For example, we encode the link from physical node 2 to physical node 3 along the path represented by the trigram 1 → 2 → 3 as resulting in the directed link 10 → 19 between state nodes 10 and 19.This encoding scheme works for up to N = 2 16 = 65, 536 physical nodes with 32-bit ids and second-order memory.

Multilayer networks
When comparing multiple multilayer networks with N layers, we encode the physical node i in layer l with id where N is the largest layer id represented with b = log 2 N bits.For multilayer networks, this encoding scheme is available in Infomap using the flag --matchable-multilayer-ids N.
Alluvial diagrams can also visualize the layers of multilayer networks, each as a separate network.In this case, node matching is trivial as physical nodes are unique in each layer.The stream fields then connect modules that span layers.

Alluvial diagram generator
We have implemented an interactive web application that generates alluvial diagrams, available for anyone to use at https://www.mapequation.org/alluvial.We implemented it as a client-side web application to enable researchers to use our application without programming experience or those working with sensitive data.All code runs locally in the user's web browser, and the web application does not store or upload network data to any server.We implemented it using TypeScript and React, and we display the diagrams using scalable vector graphics (SVG) (see Fig. S2 in the SI for how we model the data structures).
While the most efficient community detection pipeline is to run the stand-alone C ++ version of Infomap and load the resulting partitions, we have embedded a version of Infomap compiled to JavaScript with Emscripten. 33This embedded Infomap version supports the same network inputs as C ++ Infomap, but only a subset of Infomap's features, including reading directed or undirected input, choosing the number of optimization trials, and searching for multilevel or two-level solutions (Fig. 3).We defer the specification of input formats to Sec.SI.1.We also support loading solutions from Infomap Online, 34 a fully featured web-based version of Infomap.With loaded networks, the interface shows the user a top-level view of the alluvial diagram (Fig. S1).The user can manipulate the diagram in several ways: expand modules to reveal their submodules, reorganize networks and modules for clarity, highlight modules or individual nodes with different colors, and change the diagram width and height.While we have implemented the features and use cases we think most researchers use, we can imagine feature requests for specific use cases.By supporting export to SVG, researchers can modify the diagrams to their needs in any vector graphics application.

RESULTS
We highlight different visualization challenges in three case studies using multilevel, higher-order, and multilayer networks.In all cases, we use Infomap to identify optimal multilevel solutions using unrecorded teleportation to links with minimal impact from the teleportation rate on the results. 35

Robust multilevel citation networks
First, we highlight the multilevel organization of science into research areas and fields.We use data from Thomson-Reuters Journal Citation Reports. 16The data include citations between journals published from 2001-2007, divided into four two-year periods.The networks have, on average, 7, 490 nodes representing journals and 586, 295 integer-weighted links representing the citation flow between them.For each year, we use Infomap with 100 optimization trials to search for the optimal multilevel solution.We use the multilevel significance cluster-ing approach described in the Methods section to assess the solution's robustness to slight perturbations in the data.First, we create 1000 independent bootstrap networks by sampling each citation weight w uv from a Poisson distribution, ŵuv ∼ Poisson(w uv ).Then, we use Infomap to search for the optimal multilevel solution for each bootstrap network.The bootstrap solutions have similar codelengths, with a variance of around 10 −5 .Finally, we use the significance clustering algorithm to search for the largest fraction of nodes clustered together in at least a fraction p = 0.95 of the bootstrap solutions.
The resulting multilevel partitions organize science into research areas, further divided into research fields (Fig. 4).With the multilevel solution and unrecorded teleportation scheme, we do not exactly reproduce the results presented in Ref. 16 .The life sciences show higher diversification, with more significant research fields and lower citation flows in molecular-and cell biology containing J. Biol.Chem., Nature, PNAS, Science, Cell, and so on.

First-and second-order citation networks
In the second case study, we visualize the effects of using higher-order network models with alluvial diagrams.We organize the citation data from the Thomson-Reuters Journal Citation Reports into citation pathways. 36,37he data contain citations between articles published from 2007 to 2012 in the 10 000 journals with the highest impact factor, and all citation pathways contain at least one article published in 2009.When aggregated to journals, we are left with 69, 738, 205 weighted trigrams.
To study the effect of a second-order model, we model the data using both first-and second-order Markov chains.We create a first-order network by discarding the first step from each trigram.For example, the trigram i → j → k with weight w becomes the directed link j → k with the same weight, resulting in 69 million links between the 10, 000 nodes.Using the complete trigram data, we create a second-order network.For each trigram i → j → k with weight w, we create two state nodes if they do not already exist: • α i→j in physical node j representing the memory of coming from i, • α j→k in physical node k representing the memory of coming from j.
We connect the state nodes with a directed link α i→j → α j→k with weight w.The resulting second-order network has around 3.9 million state nodes connected by 69 million links.
Because the second-order network has two orders of magnitude more state nodes than the first-order network has physical nodes, the community detection search space is much larger, significantly impacting the computational time.The first-order network takes around two minutes for ten optimization trials, while the secondorder network takes around nine hours for the same task.The resulting first-order partition has codelength L (1) = 8.44 bits, five top modules, and four levels.The second-order partition has codelength L (2) = 7.83 bits, around 4, 700 top modules, and five levels.Although the second-order partition has many top modules, most are tiny, containing only one or a few state nodes.To downplay small modules at the fringe of the citation data, we compare the partition's effective number of top modules using the perplexity M eff = 2 H(M ) , with Shannon entropy where π m = i∈m π i is the total flow volume of the nodes i in module m.With this metric, the first-and second-order partitions are similar with M After detecting communities, we aggregate redundant state nodes in the second-order network before visualization for better performance.We lump state nodes in the same physical node and leaf module and aggregate their flows, reducing the number of states to visualize from 3.9 million to 355 thousand.After lumping, we remove any state nodes with zero flow that would not contribute to the alluvial diagram layout, further reducing the number of states to 271 thousand.Then, we create pseudo-states in the first-order network to match the higher-order state nodes.After this step, both networks contain 271 thousand state nodes.In the first-order network, all state nodes are in the same module as their physical node.

First-order
Second-order The alluvial diagram shows how the second-order model separates cosmology and astrophysics from the physical sciences (Fig. 4).The cell-and molecular biology submodule containing Nature, PNAS, and Science grows, and the multidisciplinary journals' submodules in the life sciences divide into smaller modules.Above all, Nature, Science, and PNAS are all recognized as multidisciplinary journals represented in multiple research fields.To quantify how a higher-order model captures their citation flows, we investigate in how many research fields journals are present.Since a single research field dominates most journals' citation flows, we measure the effective number of research fields.With journal i's module-aggregated state node flow π π π i = {π iα }, we calculate its effective number of research fields r i = 2 H(π π πi) with the entropy H(π π π i ) = − α π iα log 2 π iα .With this metric, the most overlapping journals are Bratislava Medical J., Quality and Quantity, and Harvard Business Review -tiny journals with only around 10 −4 percent of the total citation flow.To highlight prominent, multidisciplinary journals and mesoscale changes in the citation flows, we weigh each journal's effective number of research fields with its total citation flow π i = α π iα for a weighted overlap The journals with the highest weighted overlap are Nature, Science, and PNAS (Fig. 6).
The life sciences contain more of the multidisciplinary citation flow than the other research areas.By aggregating the weighted overlap o i on the leaf modules m, around 60 percent of the 1000 most overlapping leaf modules are in the life sciences, followed by the physical sciences with 18 percent.

Collaboration hypergraph using different representations
Finally, we study how a hypergraph's different firstorder and multilayer network representations affect the detected communities.We use a collaboration hypergraph extracted from the 734 references in the review article "Networks beyond pairwise interactions: structure and dynamics." 38,39The referenced articles form hyperedges linking their authors.These hyperedges overlap in those authors who authored multiple papers, with the largest connected component containing 361 author nodes in 220 hyperedges.
The hypergraph has article hyperedge weights w(e) = ln(c+1)+1 where c is the number of citations for that article in December 2020. 38To model the author's unequal contributions to articles, we use hyperedge-dependent node weights 40 γ e (i) = 2 if i is first or last author, 1 otherwise.
We weigh alphabetically sorted authors uniformly because their contributions are hard to determine.From this hypergraph, we generate bipartite and multilayer hypergraph representations with identical node visit rates using the method described in Ref. 38 (Fig. 7).We also generate a multilayer network using a so-called hyperedge-similarity model that increases the probability of a random walk staying among similar hyperedges. 38his model reinforces community structure with modules formed by similar sets of collaborators.We let Infomap search for optimal multilevel solutions in the three network representations.As before, we create pseudo-state nodes in the bipartite network to match them with the multilayer networks' state nodes.
The resulting partitions have effectively three or four levels.The top-level organization is most coarse-grained for the bipartite representation and most fine-grained for the hyperedge-similarity representation (Fig. 8).Only the multilayer representation assigns the submodule "Peixoto" together with the top module in which Bianconi is the highest-ranking author.It also assigns Fortunato to a different top module than the hyperedge-similarity partition.Finally, Bocaletti overlaps as the highest-ranking author in two submodules in the hyperedge-similarity partition in the same top module as Bianconi.

CONCLUSIONS
We have extended alluvial diagrams to higher-order networks with multilevel and overlapping communities and implemented an interactive web application available for anyone to use.In three case studies, we have used alluvial diagrams to show how the multilevel organization of science changes over time, how a second-order model compares to a first-order model, and how different hypergraph-flow equivalent networks influence the flow of ideas among network scientists.The alluvial diagram generator accepts the following input formats: clu, tree, and json (listings S1 to S9).It also accepts the ftree format, which is the same as the tree format with aggregated intra-module links, which are not used by the web application.In addition, it also understands any network format readable by Infomap and any combinations of the above files compressed as a zip file.
The "flow" column in the clu format can be substituted with any node weighting scheme to make the web application available to more researchers.

FIG. 1
FIG. 1 Schematic alluvial diagram of a multilevel network structure.a) A weighted network with modular structure, organized into a two-level solution in b).c) An alluvial diagram representation of the solutions in panels (b) and (d) using the same colors.Columns of blocks represent modules with heights proportional to the contained flow volume.The leftmost column is an ordinary two-level alluvial diagram representation.The multilevel representation to the right shows multiple levels, with the background showing the top-level organization.Stream fields connect modules in the left and right columns that share nodes.d) Multilevel solution of the network in (e).

FIG. 2
FIG.2 Schematic first-order and higher-order networks and alluvial diagram representation.a) A first-order network with pseudo-states (white dashed circles) matching the state nodes in (c).b) An alluvial diagram representation.c) A higherorder network with state nodes (small blue and purple circles) in the physical nodes.We only show the state nodes whose physical nodes are present in two modules.

FIG. 3
FIG. 3 Loading networks in the alluvial diagram generator.Three networks are loaded in different stages, shown as gray rectangles.The leftmost network has communities detected by Infomap.Infomap runs on the second network and has completed two out of five optimization trials.Infomap has yet to start identifying communities in the rightmost network.When all have finished, or when loading networks with communities from C ++ Infomap, the user can select "Create Diagram" to create an alluvial diagram.

FIG. 4
FIG. 4 Multilevel organization of science, 2001-2007.The journals organize into five large research areas, further divided into research fields.We show the top-level organization of earth sciences, economics, and computer science (the three small modules at the top).We show the finer division into research fields for the physical and life sciences.We sort the fields or areas by their citation flow and show the top-ranking journal in each research field or area.Finally, we highlight the insignificant assignment of journals clustered with Ecology in 2001 to a significantly distinct research field since 2003.At the top level shown in the inset, the same journals cluster significantly with the life sciences since 2007.

FIG. 6
FIG.6Influential multidisciplinary journals.The weighted overlap is the product of the journal's citation flow and its effective number of research fields.We limit the x-axis to six fields, but some small journals are in more than 30 research fields.

FIG. 7
FIG. 7 Schematic hypergraph with edge-dependent node weights (a) and flow-equivalent network representations.b) A bipartite representation where hyperedges form hyperedge-nodes connecting all nodes in the hyperedge.c) A multilayer representation where each hyperedge forms a layer containing the hyperedge's nodes.The figure is adapted from Ref. 38 , licensed under CC BY 4.0.

2 .
FIG. S1 Example session of the alluvial diagram generator.The main diagram view can be zoomed in by scrolling in and out.Clicking any empty area and dragging pans the view.Clicking any module (dark rectangles) selects it.Double-clicking a module (keyboard shortcut E) expands and shows its submodules if they exist.Holding the shift key while double-clicking a submodule (keyboard shortcut C) contracts and regroups the submodules' siblings into their super-module.A selected module can be moved around with the W and S keys, and networks can be re-ordered left-to-right with the A and D keys.The sidebar to the right contains all settings and controls, some available only when a module is selected by clicking on it.From top to bottom: "Load or arrange" opens the dialogue box in Fig 3."Help" displays a help dialogue."Colors" allows the user to color all or selected modules with the chosen color scheme."Module" contains information about the currently selected module."Layout" controls various diagram layout settings, such as size, module order, font sizes, etc.Finally, "Export" allows the user to export the diagram to an SVG file.