Incremental Measurement of Structural Entropy for Dynamic Graphs
3.1.5 Limitations
The limitations of the naive adjustment strategy are listed below. First, this strategy cannot deal with multiple incremental edges at the same time, e.g. a new node appears connecting with two different existing nodes. An alternative solution is to arrange all incremental edges at a certain time stamp into a sequence with which we can add the edges one by one while keeping the connectivity of the graph. In this way, the community of newly introduced nodes is inevitably related to the input order of the incremental edges. Second, it cannot handle edge or node deletions. Third, the community of the existing nodes remains unchanged, which is sub-optimal in most cases.
(57) |
-
1.
(node level) the total weight change for each node ;
-
2.
(graph level) the total weight change of the whole graph denoted by .
(61) |
(63) |
(64) |
(65) |
(66) |
(67) |
(68) |
(69) |
6.3.5 Robustness Analysis
Abstract
Structural entropy is a metric that measures the amount of information embedded in graph structure data under a strategy of hierarchical abstracting. To measure the structural entropy of a dynamic graph, we need to decode the optimal encoding tree corresponding to the best community partitioning for each snapshot. However, the current methods do not support dynamic encoding tree updating and incremental structural entropy computation. To address this issue, we propose Incre-2dSE, a novel incremental measurement framework that dynamically adjusts the community partitioning and efficiently computes the updated structural entropy for each updated graph. Specifically, Incre-2dSE includes incremental algorithms based on two dynamic adjustment strategies for two-dimensional encoding trees, i.e., the naive adjustment strategy and the node-shifting adjustment strategy, which support theoretical analysis of updated structural entropy and incrementally optimize community partitioning towards a lower structural entropy. We conduct extensive experiments on artificial datasets generated by Hawkes Process and real-world datasets. Experimental results confirm that our incremental algorithms effectively capture the dynamic evolution of the communities, reduce time consumption, and provide great interpretability.
keywords:
Structural entropy , dynamic graph , boundedness and convergence analysis , incremental algorithm[1]organization=State Key Laboratory of Software Development Environment, School of Computer Science and Engineering, Beihang University,city=Beijing, postcode=100191, country=China
[2]organization=School of Cyber Science and Technology, Beihang University,city=Beijing, postcode=100191, country=China
[3]organization=Didi Chuxing,city=Beijing, postcode=100193, country=China
1 Introduction
In 1953, Shannon [1] proposed the problem of structural information quantification to analyze communication systems. Since then, many information metrics of graph structures [2, 3, 4, 5] have been presented based on the Shannon entropy of random variables. In recent years, Li et al. [6, 7] proposed an encoding-tree-based graph structural information metric, namely structural entropy, to discover the natural hierarchical structure embedded in a graph. The structural entropy has been used extensively in the fields of biological data mining [8, 9], information security [10, 11], and graph neural networks [12, 13, 14], etc.
The computation of structural entropy [6] consists of three steps: encoding tree construction, node structural entropy calculation, and total structural entropy calculation. Firstly, the graph node set is hierarchically divided into several communities (shown in Fig. 1(a)) to construct a partitioning tree, namely an encoding tree (shown in Fig. 1(b)). Secondly, the total node degree and cut edge number of each community are counted to compute the structural entropy of each non-root node in the encoding tree. Thirdly, the structural entropy of the whole graph is calculated by summing up the node structural entropy. In general, smaller structural entropy corresponds to better community partitioning. Specifically, the minimized structural entropy, namely the graph structural entropy, corresponds to the optimal encoding tree, which reveals the best hierarchical community partitioning of the graph.
In dynamic scenarios, a graph evolves from its initial state to many updated graphs during time series [15]. To efficiently measure the quality of evolving community partitioning, we need to incrementally compute the updated structural entropy at any given time. Unfortunately, the current structural entropy methods [6, 7] do not support efficient incremental computation due to two challenges. The first challenge is that the encoding tree needs to be reconstructed for every updated graph, which leads to enormous time consumption. To address this issue, we propose two dynamic adjustment strategies for two-dimensional encoding trees111, namely the naive adjustment strategy and the node-shifting adjustment strategy. The former strategy maintains the old community partitioning, and supports theoretical structural entropy analysis, while the latter dynamically adjusts the community partitioning by moving nodes between communities based on the principle of structural entropy minimization. The second challenge is the high time complexity of structural entropy computation by the traditional definition. To tackle this problem, we design an incremental framework, namely Incre-2dSE, for efficiently measuring the updated two-dimensional structural entropy. To be specific, Incre-2dSE first utilizes the two dynamic adjustment strategies to generate Adjustments, i.e., the changes of important statistics from the original graph to the updated graph and then uses the Adjustments to calculate the updated structural entropy by newly designed incremental formula.

We conduct extensive experiments on artificial dynamic graph datasets generated by Hawkes Process and real-world datasets on the application of real-time monitoring of community partitioning quality (two-dimensional structural entropy) and community optimization. Comprehensive experimental results show that our methods effectively capture the community evolution features and significantly reduce the time consumption with great interpretability. All source code and data of this project are publicly available at https://github.com/SELGroup/IncreSE.
The main contributions of this paper are as follows:
-
1.
Proposing two dynamic adjustment strategies for two-dimensional encoding trees to avoid the reconstruction of the encoding tree for every updated graph.
-
2.
Designing an incremental framework for efficiently measuring the updated two-dimensional structural entropy with low time complexity.
- 3.
-
4.
Conducting extensive experiments on artificial and real-world datasets to demonstrate the effectiveness and efficiency of our method in dynamic measurement of community partitioning quality.
The article is structured as follows: Section 2 outlines the definitions and notations. Section 3 describes the dynamic adjustment strategies. The algorithms are detailed in Section 4, and The experiments are discussed in Section 6. Section 7 presents the related works before concluding the paper in section 8.
2 Definitions and Notations
In this section, we summarize the notations in Table 1, and formalize the definition of Incremental Sequence, Dynamic Graph, Encoding Tree, and Structural Entropy as follows.
Notation | Description |
---|---|
Graph | |
Node set; Edge set | |
Node; Edge | |
Node degree of node ; Node degree of | |
The total edge number of | |
Encoding tree | |
The root node of an encoding tree | |
The non-root node in an encoding tree, i.e., the community ID | |
The set of all -height nodes in an encoding tree | |
The label of , i.e., the node community corresponding to | |
The volume of | |
The cut edge number of | |
Dynamic graph | |
Initial state of a dynamic graph | |
The updated graph at time | |
Incremental sequence at time | |
Cumulative incremental sequence at time | |
Incremental size | |
The degree incremental of | |
The volume incremental of | |
The cut edge number incremental of | |
The degree-changed node set | |
The set of -height tree nodes whose volume or cut edge | |
number change | |
The structural entropy of by | |
Global Invariant with incremental size | |
Local Difference, i.e., the approximation error between | |
and |
Definition 1 (Incremental Sequence).
An incremental sequence is a set of incremental edges represented by , where denotes an incremental edge with two endpoints and . The operator represents that the edge will be added to or removed from a graph. The number of the incremental edges is named the incremental size.
Definition 2 (Dynamic Graph).
In this work, a dynamic graph is defined as a series of snapshots of a temporal, undirected, unweighted, and connected graph . denotes the initial state and denotes the updated graph at time . To describe the temporal dynamic graph, we suppose that an incremental sequence arrives at each non-zero time . The updated graph is generated by orderly combining all new edges and nodes introduced by with , i.e., . We further define the cumulative incremental sequence at time , denoted by , as the sequence formed by sequentially concatenating sequences , and then we have .
Definition 3 (Encoding Tree).
The concept of the encoding tree is the same as “the Partitioning Tree” proposed in the previous work [6]. The encoding tree of a graph is an undirected tree that satisfies the following properties:
-
1.
The root node in has a label .
-
2.
Each non-root node in has a label .
-
3.
For each node in , if are all immediate successors of , then is a partitioning of .
-
4.
The label of each leaf node is a single node set, i.e., .
-
5.
denotes the height of a node in . Let and , where is the parent of . The height of the encoding tree , namely the dimension, is equal to the maximum of .
Definition 4 (Structural Entropy).
The structural entropy is defined by Li and Pan [6]. We follow this work and state the definition below. Given an undirected, unweighted, and connected graph and its encoding tree , the structural entropy of by is defined as:
(1) |
where is the total edge number of ; is the cut edge number of , i.e., the number of edges between nodes in and not in ; is the volume of , i.e., the sum of the degrees of all nodes in ; denotes logarithm with a base of 2. We name as the -dimensional structural entropy if ’s height is .
The graph structural entropy of is defined as:
(2) |
where ranges over all possible encoding trees.
If the height of is restricted to , the -dimensional graph structural entropy of is defined as:
(3) |
where ranges over all the possible encoding trees of height . The encoding tree corresponding to , which minimizes the -dimensional structural entropy, is named the optimal -dimensional encoding tree.
3 Dynamic Adjustment Strategies for Two-Dimensional Encoding Trees
In this section, we first introduce the naive adjustment strategy and analyze the updated structural entropy under this strategy. Then, we describe the node-shifting adjustment strategy which leads to lower structural entropy, and provide its theoretical proof.
3.1 Naive Adjustment Strategy
In this part, we first provide a formal description of the naive adjustment strategy. Next, we introduce two metrics, Global Invariant and Local Difference, to realize the incremental computation of updated structural entropy. Finally, we analyze the boundedness and convergence of the Local Difference.
3.1.1 Strategy Description
Before we introduce the naive adjustment strategy, we first discuss the form of the two-dimensional encoding trees in detail and the formula of their corresponding structural entropy. For all possible two-dimensional encoding trees, whenever there is a leaf node () whose height is (like Fig. 2(b)), we can connect it with a child node with the same label to make all leaf nodes have height (Fig. 2(c)). At this time, the structural entropy remains unchanged since the additional term induced by , i.e. , equals to .

In other words, the two encoding trees in Fig. 2 are equivalent. Therefore, in this paper, we only consider the two-dimensional encoding trees where the height of all leaf nodes is for the sake of brevity. Given a graph and its two-dimensional encoding tree , the two-dimensional structural entropy of by can uniformly be formulated as:
(4) |
where denotes the set of -height nodes in , i.e., .
Now we present the description of the naive adjustment strategy. This strategy comprises two parts: the edge strategy and the node strategy. The edge strategy dictates that incremental edges do not alter the encoding tree’s structure. On the other hand, the node strategy specifies that when a new node connects with an existing node (shown in Fig. 3(a)), and corresponds to a leaf node in the two-dimensional encoding tree, i.e., (shown in Fig. 3(b)), a new leaf node with a label will be set as an immediate successor of ’s parent ( in Fig. 3(d)), instead of another 1-height node ( in Fig. 3(f)). We can describe the modification of the encoding trees from the community perspective. Specifically, the incremental edges do not change the communities of the existing nodes while the new node is assigned to its neighbor’s community ( in Fig. 3(c)), rather than another arbitrary community ( in Fig. 3(e)). Obviously, we can get the updated encoding tree, i.e., the updated community partitioning, in the time complexity of given an incremental sequence of size . To ensure that the node strategy minimizes the updated structural entropy most of the time, we give the following theorem.

Theorem 1.
Suppose that a new graph node is connected to an existing node , where . If , we have:
(5) |
where denotes the updated structural entropy when the new node is assigned to ’s community , i.e., , and represents the updated structural entropy when is allocated to another arbitrary community , i.e., .
Proof. Differentiating the updated structural entropy of the two cases above, we can obtain:
(6) |
Here we define:
(7) | ||||
(8) |
Let be the minimum proportion of the in-community edges in each community, i.e.,
(9) |
Since and , we have:
(10) | ||||
(11) |
So
(12) | ||||
Therefore, if the following condition holds:
(13) |
According to Theorem 1, our node strategy minimizes the updated structural entropy when the total volume of the whole graph is approximately larger than times the maximum volume of all communities. Usually, we have , so the real condition is much looser.
3.1.2 Global Invariant and Local Difference
In this part, we introduce two quantities, Global Invariant and Local Difference, to realize the approximation and the fast incremental calculation of the updated structural entropy by naive adjustment strategy. When an incremental sequence with size is applied to a graph , resulting in a new graph and its corresponding two-dimensional encoding tree using the naive adjustment strategy, the updated two-dimensional structural entropy can be expressed as:
(14) |
we can get the Global Invariant in the time complexity of if , , and are saved. The Local Difference can also be computed in given the necessary incremental changes. Overall, the updated two-dimensional structural entropy can be calculated in
Definition 5 (Global Invariant).
Given an original graph and its two-dimensional encoding tree , the Global Invariant is defined as an approximate value of the updated structural entropy after an incremental sequence with size , i.e.,
(15) |
where
(16) | ||||
(17) | ||||
(18) |
Definition 6 (Local Difference).
Given the updated graph , the updated two-dimensional encoding tree , and incremental size , the Local Difference is defined as the difference between the exact updated two-dimensional structural entropy and the Global Invariant, as shown below:
(19) |
where
(20) | ||||
(21) | ||||
(22) |
Here, denotes the incremental change in degree , represents the incremental change in volume , represents the incremental change in cut edge , denotes the set of nodes that have changes in degree , and denotes the set of -height tree nodes that have changes in or , i.e., .
3.1.3 Boundedness Analysis
According to Eq. (19), the bounds of can be obtained by analyzing its components, namely , and . First, we analyze the maximum and minimum values of . We define
(23) |
Since is monotonically increasing with , takes the maximum value when new incremental edges connect the two nodes with the largest degree. Therefore, we have
(24) |
where denotes the maximum degree in . Since multiple edges are not allowed, the equality may hold if and only if . When each of the incremental edges connects a one-degree node and a new node, is minimized:
(25) |
Second, we analyze the bounds of and . For convenience, we define
(26) |
We commence by analyzing the bound of when adding one new edge. If a new edge is added between two communities and , we can get
(27) |
Thus we have
(28) |
and
(29) |
where denotes the maximum volume of all . If a new edge is added within a single community (or a new node is connected with an existing node in ), we have
(30) |
Then we can obtain
(31) |
and
(32) |
where denotes the minimum volume of all . We next analyze the bound of when adding new edges. When the edges are all between the two communities with the largest volume, we have:
(33) | ||||
and takes the minimum value:
(34) |
When each of the edges is added within communities with the smallest volume, respectively, takes its maximum value:
(35) |
Finally, we can get a lower bound of as
(36) |
An upper bound of is as follows:
(37) |
3.1.4 Convergence Analysis
In this section, we analyze the convergence of the Local Difference as well as its first-order absolute moment. To denote that one function converges at the same rate or faster than another function, we use the notation , which is equivalent to , where is a constant.
Theorem 2.
Given the incremental size , the Local Difference converges at the rate of , represented as:
(38) |
Proof. The lower bound of is given by:
(39) |
Similarly, the upper bound is given by:
(40) |
Since
(41) |
Theorem 38 is proved.∎
It follows that the difference between the exact value of the updated two-dimensional structural entropy and the Global Invariant converges at the rate of .
Definition 7.
Let be a random variable representing the incremental size . We remind that .
Theorem 3.
The first-order absolute moment of the Local Difference converges at the rate of :
(42) |
Proof. We can represent the expectation of the lower bound of as:
(43) |
Similarly, the expectation of the upper bound is given by:
(44) |
Finally, since
(45) |
Theorem 42 is proved.∎
3.2 Node-Shifting Adjustment Strategy
Although the naive adjustment strategy can quickly obtain an updated two-dimensional encoding tree and its corresponding structural entropy, we still need a more effective strategy to get a better community partitioning towards lower structural entropy. Therefore, we propose another novel dynamic adjustment strategy, namely node-shifting, by moving nodes to their optimal preference communities (Definition 8) iteratively. Different from the naive adjustment strategy, edge changes can change the communities of the existing nodes to minimize the structural entropy. Besides, this strategy supports multiple incremental edges at the same time and the removal of the existing edges. Therefore, the node-shifting adjustment strategy fully overcomes the limitations of the naive adjustment strategy listed in Section 3.1.5. In the following, we first describe the node-shifting adjustment strategy in detail and then prove that the node’s movement towards its optimal preference community can get the lowest structural entropy greedily. Finally, we discuss the limitations of this strategy.
3.2.1 Strategy Description
We first define the optimal preference community (OPC) (Definition 8) Then the node-shifting adjustment strategy can be described as follows: (1) let involved nodes be all nodes that appeared in the incremental sequence; (2) for each involved node, move it to its OPC; (3) update the involved nodes to all nodes connected with the shifted nodes but in different communities, then repeat step (2).
Definition 8 (Optimal Preference Community (OPC)).
Given a graph and a target node , the optimal preference community of is defined as the community in which
(46) |
where denotes the number of the edges connected between and .
Fig. 4 and Fig. 5 give examples to illustrate the node-shifting adjustment strategy in different situations. Fig. 4 shows how incremental edges affect community partitioning. In Fig. 4(a), the graph is divided into communities and . In Fig. 4(b), incremental edges (red dotted) are inserted into the graph. Then all involved nodes (red outlined) are checked for moving into their OPCs. In this step, one green node is shifted from to (denoted by the red arrow). In Fig. 4(c), the shifted node in the previous step “sends messages” (red dotted arrows) to its neighbors in (red outlined). The nodes that received the message (red outlined) are then checked for shifting. At this time, another green node moves into . In Fig. 4(d)-(e), the graph follows the above process to continue the iterative update. The final community partitioning is shown in Fig. 4(f). Fig. 5 shows how new nodes are assigned to communities. Fig. 5(a) gives a nodes graph with communities. In Fig. 5(b), new nodes (white filled) are added with incremental edges and they belong to no community. Then all of them and their existing neighbors become involved nodes. Next, the upper new node is assigned to because is determined as its OPC. Also, the lower two new nodes are moved into their OPCs. In Fig. 5(c), the new involved nodes (red outlined) are checked. Fig. 5(d) shows the final state of this node-shifting process.


3.2.2 Theoretical Proof
In this part, we provide a simplified model (Fig. 6) to theoretically derive the OPC’s solution formula (Eq. (46)). In the graph of this model, there exists communities . There is also a target node which does not belong to any community. The number of the edges connected between and is denoted by . The volume and the number of the cut edges of are denoted by and , respectively. Then we have Theorem 47.

Theorem 4.
Suppose that the node is moving into community . The updated structural entropy is minimized when moves into where
(47) |
Proof. Let be the two-dimensional structural entropy after moves into . Then is given by
(48) | ||||
Therefore, the structural entropy is minimized when moves into where
(49) |
Let the structural entropy before the node movement be given by
(50) |
Since is independent of , we have
(51) | ||||
Therefore Theorem 47 is proved.∎
3.2.3 Limitations
The limitations of the node-shifting adjustment strategy are listed below. , it is hard to give the bound of the gap between the Global Invariant and the updated structural entropy . , the node-shifting adjustment strategy may not converge in some cases (Fig. 7 gives an example), which forces us to set the maximum number of iterations.

3.3
4 Incre-2dSE: an Incremental Measurement Framework of the Updated Two-Dimensional Structural Entropy
4.1
Definition 9 (Structural Data).
Given a graph , the Structural Data of is defined as follows:
-
1.
(node level) the degree of each ;
-
2.
(community level) the volume and the cut edge number ;
-
3.
(graph level) the total edge number ;
-
4.
(node-community map) the community ID belongs to, denoted by where ;
-
5.
(community-node map) the community of each .
Definition 10 (Structural Expressions).
The Structural Expressions of are defined as follows:
-
1.
(node level)
(52) where denotes the node number of each while denotes the set of all distinct degrees in ;
-
2.
(community level)
(53) -
3.
(graph level)
(54)
Definition 11 (Adjustment).
The Adjustment from the original graph to the updated graph is defined as follows:
-
1.
(node level) the degree change for each node and the node number change of each , where denotes the set of the degrees which have node number changes from to ;
-
2.
(community level) the volume change and the cut edge number change of each ;
-
3.
(graph level) the total edge number change ;
-
4.
(node-community map) the change list of the node-community map Structural Data denoted by where denotes the new community ID of ;
-
5.
(community-node map) the change list of the community-node map Structural Data denoted by where denotes that community is updated as or .
4.2 Outline

The illustration of our incremental framework Incre-2dSE and its static baseline, the traditional offline algorithm (TOA), is shown in Fig. 8. Incre-2dSE aims to measure the updated two-dimensional structural entropy given the original graph, the original encoding tree, and the incremental sequences. This framework consists of two stages, initialization and measurement. In the initialization stage, the Structural Data (Definition 9), which contains a graph’s essential data to compute the structural entropy, is extracted from the original graph and its encoding tree (Fig. 8 ). Then the Structural Expressions (Definition 10), which are defined as the expressions of the Structural Data, are computed and saved (Fig. 8 ). For the same original graph, Initialization only needs to be performed once. In the measurement stage, the Adjustment (Definition 11), which is defined as a data structure storing the changes in degree, volume, and cut edge number from the original graph to the updated graph, is first generated and saved according to the structural data and the incremental sequence by the Adjustment generation algorithm with the naive adjustment strategy (NAGA) or the node-shifting adjustment strategy (NSGA) (Fig. 8 ). Then, the Adjustment-based incremental updating algorithm (AUIA) is called to gather the Structural Data, the Structural Expression, and the Adjustment to efficiently calculate the updated structural entropy and update the Structural Data and the Structural Expressions (Fig. 8 ). As the baseline, TOA commences by updating the graph using the incremental sequence (Fig. 8ⓐ). Next, the new encoding tree of the updated graph is reconstructed using a static community detection method (Fig. 8ⓑ). Then, the updated Structural Data is extracted (Fig. 8ⓒ), and finally, the updated structural entropy is computed by definition (Fig. 8ⓓ).
4.3 The Incremental Framework
4.3.1 Stage 1: Initialization
Given a graph as a sparse matrix and its two-dimensional encoding tree represented by a dictionary like {community ID : node list , community ID : node list , …}, the Structural Data (Definition 9) can be easily obtained and saved in the time complexity of (Fig. 8 ). Then the Structural Expressions (Definition 10) can be calculated with the saved Structural Data in (Fig. 8 ). Overall, the Initialization stage requires total time complexity .
4.3.2 Stage 2: Measurement
In this stage, we first need to generate the Adjustment (Definition 11) from to . We provide two algorithms for generating Adjustments by the proposed two dynamic adjustment strategies, namely the naive adjustment generation algorithm (NAGA) and the node-shifting adjustment generation algorithm (NSGA) (Fig. 8 ). The input of both two algorithms is the Structural Data of the original graph and an incremental sequence and the output is an Adjustment. The pseudo-code of NAGA and NSGA are shown in Algorithm 1 and Algorithm 2, respectively. The time complexity of NAGA is because it needs to traverse edges in the incremental sequence and it only costs for each edge. In NSGA, we first need to initialize the Adjustment (line -). Second, in the node-shifting part (line -), we need to determine the OPC for all involved nodes, which costs . This step is repeated times and the time cost is , where denotes the number of the involved nodes in the -th iteration. Since and most of the time, the total time complexity of NSGA is .
After getting the Adjustment, the updated two-dimensional structural entropy of can then be incrementally calculated by:
(55) |
where , , and denote the incrementally updated Structural Expressions:
(56) | ||||
To implement the above incremental calculation process, we provide the Adjustment-based incremental updating algorithm (AIUA) (Fig. 8 ). Given the input, i.e., the Structural Data and Structural Expressions of the original graph and an Adjustment to the updated graph, we can compute the updated two-dimensional structural entropy incrementally, and update the Structural Data and Structural Expressions efficiently preparing for the next AIUA process when a new Adjustment comes. The pseudo-code of AIUA is shown in Algorithm 3. The time complexity of updating the Structural Data is . The time complexity of updating the Structural Expressions is . The time complexity of calculating the updated two-dimensional structural entropy is . In summary, the total time complexity of AIUA is .
4.4
The traditional offline algorithm (TOA) reconstructs the encoding tree for each updated graph and calculates the updated two-dimensional structural entropy by definition. TOA consists of the following four steps. Firstly, it generates the updated graph by combining the original graph and the incremental sequence (ⓐ in Fig. 8). Secondly, it partitions the graph node set into communities using several different static community detection algorithms, e.g., Infomap [16], Louvain [17], and Leiden [18], to construct the two-dimensional encoding tree (ⓑ in Fig. 8). Thirdly, the node-level, community-level, and graph-level Structural Data of the updated graph is counted and saved (ⓒ in Fig. 8). Finally, the updated structural entropy is computed via Eq. (14) (ⓓ in Fig. 8). The total time cost of TOA is plus the cost of the chosen community detection algorithm. The pseudo-code of TOA is shown in Algorithm 4.
5
5.1
(58) |
(59) |
5.2
5.2.1
Definition 12 ().
Definition 13 ().
5.2.2
Definition 14 ().
Theorem 5 ().
Definition 15 ().
Definition 16 ().
5.2.3

6 Experiments and Evaluations
In this section, we conduct extensive experiments based on the application of dynamic graph real-time monitoring and community optimization. Below we first describe the artificial dynamic graph datasets and real-world datasets. Then we give the experimental results and analysis.
6.1 Artificial Datasets
First, we generate different initial states of the dynamic graphs by utilizing the random_partition_graph (Random) [19], gaussian_random_partition _graph (Gaussian) [20], and stochastic_block_model (SBM) [21] methods in “Networkx” [22] (a Python library).
-
1.
This method has parameters. The first parameter is a list of community sizes , which denotes the node number of each community of the initial state. The other two parameters are two probabilities and . Nodes in the same community are connected with and nodes across different communities are connected with .
- 2.
- 3.

After that, we generate incremental sequences and updated graphs for each initial state by Hawkes Process [23] referring to some settings of Zuo et al. [24]. Hawkes Process [23] models discrete sequence events by assuming that historical events can influence the occurrence of current events.
(70) |
(71) |
Parameter values | |
---|---|
Random initial state | , , and . |
Gaussian initial state | The total node number is , , , , and . |
SBM initial state | , * , and . |
Hawkes process | The dimension of the embedding vectors is set as and is . |
-
*
denotes uniform distribution.
of snapshots | |||||
---|---|---|---|---|---|
20 | |||||
20 | |||||
20 | |||||
Cit-HepPh | 20 | ||||
20 | |||||
20 |
6.2 Real-World Datasets
For the real-world datasets, we choose Cit-HepPh [26], DBLP [27], and Facebook [28] to conduct our experiments. Cit-HepPh is a citation network in the field of high-energy physics phenomenology from to . Facebook records the establishment process of the user friendship relationship of about Facebook users in New Orleans from to . For each dataset, we cut out consecutive snapshots (an initial state and updated graphs). Since structural entropy is only defined on connected graphs, we only preserve the largest connected component for each snapshot. Overall, the statistics of the artificial and real-world datasets are briefly shown in Table 3.
6.3 Results and Analysis
6.3.1 Application: Dynamic Graph Real-Time Monitoring and Community Optimization
In this application, we aim to optimize the community partitioning and monitor the corresponding two-dimensional structural entropy by our incremental algorithms, i.e., NAGA+AIUA and NSGA+AIUA, and the baseline TOA to quantify the community quality in real-time for each snapshot of a dynamic graph. Specifically, for each dataset, we first choose a static community detection method (referred to as static methods) from Infomap [16], Louvain [17], and Leiden [18] to generate the initial state’s community partitioning. In this paper, Louvain is complemented by the louvain_communities method in “Networkx” [22]. Infomap and Leiden are complemented by the community_infomap and the community_leiden methods from the Python library “igraph” [29], respectively. Louvain and Infomap algorithms take default parameters while in Leiden we use “Modularity” as the objective instead of the original setting “Constant Potts Model (CPM)”. This is because Leiden with CPM cannot effectively partition the communities on our datasets, as all partitions generated by Leiden with CPM contain only one node. Then we use NAGA+AIUA, NSGA+AIUA, and TOA to respectively measure the updated two-dimensional structural entropy at each time stamp. The default maximum iteration number of NSGA is set as and the reason is discussed in Section 6.3.3.


The experimental results are shown in Fig. 11 . Overall, the structural entropy obtained by NSGA+AIUA based on the node-shifting strategy, is completely smaller than that obtained by based on the naive adjustment strategy, in all settings. For example, , NSGA+AIUA reduces the updated structural entropy by up to about and on Facebook and DBLP respectively. This verifies that the node-shifting strategy is theoretically and practically able to reduce the structural entropy and represents that the strategy can obtain a significantly better encoding tree (community partitioning) than the naive adjustment strategy.
While maintaining high efficiency (evaluated in Section 6.3.3), our incremental algorithms still exhibit a performance that is close to or better than .
6.3.2 Hyperparameter Study
In this part, we evaluate the influence on the updated structural entropy of different iteration numbers of the node-shifting adjustment strategy. We use NSGA + AIUA with iteration number to measure the mean updated structural entropy of the updated graphs, respectively, on each situation in Section 6.3.1. As we can see from Table 4, the updated structural entropy decreases as the number of iterations increases most of the time. The reason is that, as the number of iterations increases, more nodes will shift to their OPC, which leads to the further reduction of the structural entropy. This experiment also demonstrates that our node-shifting adjustment strategy has excellent interpretability.
of iterations () | |||||
---|---|---|---|---|---|
Cit-HepPh | Infomap | 9.7155 | 9.7126 | 9.7122 | 9.7120 |
Louvain | 10.7804 | 10.7791 | 10.7786 | 10.7784 | |
Leiden | 10.7802 | 10.7792 | 10.7788 | 10.7786 | |
DBLP | Infomap | 7.3274 | 7.3255 | 7.3244 | 7.3242 |
Louvain | 9.4851 | 9.4842 | 9.4841 | 9.4838 | |
Leiden | 9.3919 | 9.3917 | 9.3912 | 9.3909 | |
Infomap | 10.2134 | 10.2075 | 10.2060 | 10.2055 | |
Louvain | 11.2946 | 11.2898 | 11.2876 | 11.2864 | |
Leiden | 11.3087 | 11.3052 | 11.3038 | 11.3030 | |
Random-Hawkes | Infomap | 11.7836* | 11.7832 | 11.7831 | 11.7831 |
Louvain | 11.7836* | 11.7832 | 11.7831 | 11.7831 | |
Leiden | 11.7836* | 11.7832 | 11.7831 | 11.7831 | |
Gaussian-Hawkes | Infomap | 11.3352 | 11.3348 | 11.3347 | 11.3346 |
Louvain | 11.3352 | 11.3348 | 11.3347 | 11.3346 | |
Leiden | 11.3352 | 11.3348 | 11.3347 | 11.3346 | |
SBM-Hawkes | Infomap | 11.6596 | 11.6595 | 11.6595 | 11.6595 |
Louvain | 11.6596 | 11.6595 | 11.6595 | 11.6595 | |
Leiden | 11.6596 | 11.6595 | 11.6595 | 11.6595 |
- *
6.3.3 Time Consumption Evaluation
Fig. 13 shows the time consumption comparison between our incremental algorithms, i.e. NAGA+AIUA and NSGA+AIUA (), on all datasets. The vertical axis in the figure represents the mean time consumption of the chosen incremental algorithm across all snapshots. The horizontal axis represents selected static methods. As we can see, the time cost of NSGA+AIUA increases as the increase of iteration number . In addition, the time consumption of NAGA+AIUA is less than NSGA+AIUA with in most cases.

Dataset | Cit-HepPh | DBLP | |||||||
---|---|---|---|---|---|---|---|---|---|
Static Method | Infomap | Louvain | Leiden | Infomap | Louvain | Leiden | Infomap | Louvain | Leiden |
Online Time1 | 2 | ||||||||
Offline Time | |||||||||
Speedup3 | x | x | x | x | x | x | x | x | x |
Dataset | Random-Hawkes | Gaussian-Hawkes | SBM-Hawkes | ||||||
Static Method | Infomap | Louvain | Leiden | Infomap | Louvain | Leiden | Infomap | Louvain | Leiden |
Online Time | |||||||||
Offline Time | |||||||||
Speedup | x | x | x | x | x | x | x | x | x |
-
1
Time cost of NSGA+AIUA ().
-
2
Mean time consumption over time stamps.
-
3
Speedup = Offline Time/Online Time.
The reason why we choose as the default parameter is as follows. As shown in Fig. 13, the time consumption of the node-shifting strategy rises linearly with . However, Table 4 shows that the rate of decline of structural entropy gradually decreases from to , and the structural entropy values of and are very close. That is, the optimization efficiency of structural entropy decreases with increasing . To seek a balance between efficiency and effectiveness, we take the compromise value .
6.3.4 Update Threshold Analysis
In scenarios with minimal changes, updating structural information might not be necessary. In this part, we set a threshold for the magnitude of graph changes before initiating updates to cut total time consumption. Specifically, the updated structural entropy will not be calculated until the incremental edge number exceeds a certain percentage (referred to as the update threshold ) of the edge number of the last updated graph. As we can see from Table 6, the total time reduces - with NAGA+AIUA and - with NSGA+AIUA when is set from to . Meanwhile, the fluctuation of the final structural entropy remains within , which indicates that the threshold has little impact on the precision of structural entropy. Overall, the setting of the updated threshold leads to improved efficiency and better adaptation to graphs undergoing frequent alterations.
Updated Threshold | ||||||
---|---|---|---|---|---|---|
NA1 | Total Time | 2 | () | () | () | |
Final SE | 3 | |||||
NS1 | Total Time | |||||
Final SE |
-
1
“NA/NS” represents NAGA/NSGA+AIUA.
-
2
The percentage reduction in time consumption compared to the case where .
-
3
The percentage fluctuation of the final structural entropy compared to the case where .
In this subsection, we evaluate the robustness of the proposed framework on new artificial datasets with different noise conditions. Specifically, we generate initial states using the random partition method mentioned in Section 6.1 with (representing the noise) ranging from to and . For the convenience of comparison, the total edge number of the initial state is kept nearly the same, fluctuating between and , by manually selecting the appropriate . After the generation of the initial states, we use the Hawkes Process to generate incremental edges, around times the initial edges, and split them into sub-sequences as the incremental of time stamps. Then we use NAGA/NSGA+AIUA and TOA to calculate the structural entropy for all updated graphs and the results are shown in Fig. 14.

As we can see from Fig. 14, the structural entropy curves using NAGA/ NSGA+AIUA are smooth no matter what takes. However, one or two jumps in structural entropy take place when it comes to . Furthermore, the higher the noise () is, the earlier and larger the structural entropy mutates, and the more unstable the algorithm is. Additionally, upon examination, the number of communities does not change, meaning that these abrupt changes do not stem from changes in the number of communities, but due to dramatic changes in their content. Therefore, we can conclude that our algorithm maintains the structural entropy at a stable and lower level due to the property of keeping the original community structure from changing drastically, showing high robustness to the increasing noise.
In addition, we note that the structural entropy curve gradually shifts upward as increases. This is because the numbers of edges of the initial states have slight errors. Specifically, the larger the , the more initial edges there are (from to ).
6.3.6 Gap between Incre-2dSE and the Current Static Structural Entropy Measurement Method
In this part, we try to study the gap between Incre-2dSE and the current static algorithms. The current mainstream static algorithm for structural entropy measurement is named structural entropy minimization (SEM) [6], which is a greedy -dimensional encoding tree construction algorithm for static graphs whose objective function is structural entropy. Fig. 15 gives an illustration of the SEM algorithm in two-dimensional cases (2d-SEM). Fig. 15(a) is an example graph. We first construct a one-dimensional encoding tree for this graph (Fig. 15(b)). The one-dimensional encoding tree has one root and leaf nodes. Next, we add a successor node to each leaf node to construct an initialized two-dimensional encoding tree (Fig. 15(c)). Then we select the best pair of -height nodes to merge them which minimizes the structural entropy (Fig. 15(d)). At last, We repeat this merging step until the structural entropy doesn’t go down to get the final two-dimensional encoding tree (Fig. 15(e)).

We measure the structural entropy of Incre-2dSE (NAGA/NSGA+AIUA) and 2d-SEM222https://github.com/RingBDStack/SITool/tree/main/python through all timestamps like Section 6.3.1 on the six datasets mentioned in Table 3. According to our experimental results (Fig. 16), there is a gap between the structural entropy of 2d-SEM and our dynamic framework Incre-2dSE in some cases. Specifically, on all datasets except DBLP, the structural entropy of NAGA+AIUA is higher than but very close to 2d-SEM. On DBLP, NAGA+AIUA is better than 2d-SEM. On the contrary, NSGA+AIUA performs significantly better than 2d-SEM on all datasets. In addition, the gap between NSGA+AIUA and 2d-SEM is gradually increasing on Cit-HepPh and Facebook, is gradually decreasing on Random-Hawkes and Gaussian-Hawkes, and remains almost unchanged on DBLP and SBM-Hawkes. The reason why there is a gap between Incre-2dSE and 2d-SEM is the same as the reason why there is a gap between Incre-2dSE and TOA in Section 6.3.1—Incre-2dSE updates the community and encoding tree locally and incrementally while 2d-SEM constructs encoding trees globally from scratch for each snapshot.

6.3.7 Convergence Evaluation
In this part, we conduct a statistical experiment to confirm the convergence of the Local Difference and its first-order absolute moment. We first generate artificial original graphs with increasing total edge numbers from to . Based on each original graph, we generate incremental sequences with size sampling from a normal distribution with a mean of and a standard deviation of . These incremental sequences are generated by repeatedly adding edges within a community with probability , adding edges across two random communities with probability , and adding nodes with probability . We then count the Local Difference and its upper bound. The results are shown in Fig. 17. As the total edge number increases from to times, the mean Local Difference gradually decreases by (from to ), respectively, and is always positive. This solidly supports the convergence of the Local Difference and its first-order absolute moment. Moreover, the Local Difference is always below its upper bound, which confirms the validity of our bound.

6.3.8
In this subsection, we evaluate the time consumption of the two approximate one-dimensional structural entropy measurement methods, Global Aggregation and Local Propagation, on two artificial datasets, i.e., Erdős-Rényi (ER) [30] and Cycle.
For each initial state, we use Global Aggregation with iteration number to calculate the initial stationary distribution from a uniform distribution. For each initial state, we then use Global Aggregation and Local Propagation to iteratively calculate the structural entropy of the updated graphs and record the time consumption of each iteration.
The time consumption experimental results are shown in Fig. 18. On the ER dataset, Local Propagation is faster than Global Aggregation only in the first several iterations. Besides, the time consumption is lower when is smaller. This is because the time consumption of each iteration of Local Propagation is approximately linear with the size of the involved node set. The smaller the incremental size , the number of the involved nodes is less. However, since the mean number of the successors of ER graphs is more than , the involved nodes will rapidly expand into the entire node set. Therefore, when the iteration number is larger than , the efficiency of Local Propagation is nearly the same as that of Global Aggregation. On the contrary, in the Cycle dataset, the mean number of the direct successors of each node is nearly . That is, the size of the involved node set will not change, so the time consumption of Local Propagation will not increase as the iteration number grows. In addition, obviously the larger the incremental size , the higher the time consumption whatever the iteration number is.

7 Related Works
Graph Entropy. Many efforts have been devoted to measuring the information in graphs. The graph entropy was first defined and investigated by Rashevsky [2], Trucco [3], and Mowshowitz [4]. After that, a different graph entropy closely related to information and coding theory was proposed by Körner[5]. Later, Bianconi [31] introduced the concept of “structural entropy of network ensembles”, known as the Gibbs entropy. Anand et al. [32] proposed the Shannon entropy for network ensembles. Braunstein et al. [33] proposed the von Neumann graph entropy based on the combinatorial graph Laplacian matrix. These three metrics [31, 32, 33] are defined by statistical mechanics and are used to compare different graph models. However, most of the current graph entropy measures are based on the Shannon entropy definition for probability distributions, which has significant limitations when applied to graphs [34]. Recently, many efforts have been devoted to capturing the dynamic changes of graphs, e.g., the research based on the Algorithmic Information Theory [35, 36]. The structural entropy method used in this paper proposed by Li et al. [6] provides an approach to measuring the high-dimensional information embedded in graphs and can further decode the graph’s hierarchical abstracting by an optimal encoding tree. This method is widely used in the fields of graph learning [14], reinforcement learning [37], and social networks [38].
Fast Computation for Graph Entropy. Chen et al. [39] proposed a fast incremental von Neumann graph entropy computational framework, which reduces the cubic complexity to linear complexity in the number of nodes and edges. Liu et al. [40, 41] used the structural entropy [6] as a proxy of von Neumann graph entropy for the latter’s fast computation and also implemented an incremental method for one-dimensional structural entropy . In this paper, we mainly focus on the incremental computation for two-dimensional structural entropy based on our dynamic adjustment strategies for encoding trees.
8 Conclusion
In this paper, we propose two novel dynamic adjustment strategies, namely the naive adjustment strategy and the node-shifting adjustment strategy, to analyze the updated structural entropy and incrementally adjust the original community partitioning towards a lower structural entropy. We also implement an incremental framework, i.e., supporting the real-time measurement of the updated two-dimensional structural entropy. In the future, we aim to develop more dynamic adjustment strategies for hierarchical community partitioning and incremental measurement algorithms for higher dimensional structural entropy.
Acknowledgments
This work is supported by the National Key R&D Program of China through grant 2022YFB3104703, NSFC through grants 62322202 and 61932002, Beijing Natural Science Foundation through grant 4222030, Guangdong Basic and Applied Basic Research Foundation through grant 2023B1515120020, CCF-DiDi GAIA Collaborative Research Funds for Young Scholars, and the Fundamental Research Funds for the Central Universities.
References
- [1] C. Shannon, The lattice theory of information, Transactions of the IRE Professional Group on Information Theory 1 (1) (1953) 105–107.
- [2] N. Rashevsky, Life, information theory, and topology, The Bulletin of Mathematical Biophysics 17 (3) (1955) 229–235.
- [3] E. Trucco, A note on the information content of graphs, The Bulletin of Mathematical Biophysics 18 (2) (1956) 129–135.
- [4] A. Mowshowitz, Entropy and the complexity of graphs, Tech. rep. (1967).
- [5] J. Körner, Coding of an information source having ambiguous alphabet and the entropy of graphs, in: Proceedings of the Prague Conference on Information Theory, 1973, pp. 411–425.
- [6] A. Li, Y. Pan, Structural information and dynamical complexity of networks, IEEE Transactions on Information Theory 62 (6) (2016) 3290–3339.
- [7] A. Li, Mathematical Principles of Information World: Calculuses of Information, Preprint., 2022.
- [8] A. Li, X. Yin, B. Xu, D. Wang, J. Han, Y. Wei, Y. Deng, Y. Xiong, Z. Zhang, Decoding topologically associating domains with ultra-low resolution hi-c data by graph structural entropy, Nature Communications 9 (1) (2018) 1–12.
- [9] Y. W. Zhang, M. B. Wang, S. C. Li, Supertad: robust detection of hierarchical topologically associated domains with optimized structural information, Genome Biology 22 (1) (2021) 1–20.
- [10] Y. Liu, J. Liu, Z. Zhang, L. Zhu, A. Li, Rem: From structural entropy to community structure deception, in: Proceedings of the NeuIPS, Vol. 32, 2019, pp. 12918–12928.
- [11] A. Li, X. Zhang, Y. Pan, Resistance maximization principle for defending networks against virus attack, Physica A: Statistical Mechanics and its Applications 466 (2017) 211–223.
- [12] Z. Yang, G. Zhang, J. Wu, J. Yang, Q. Z. Sheng, H. Peng, A. Li, S. Xue, J. Su, Minimum entropy principle guided graph neural networks, in: Proceedings of the sixteenth ACM international conference on web search and data mining, 2023, pp. 114–122.
- [13] J. Wu, X. Chen, K. Xu, S. Li, Structural entropy guided graph hierarchical pooling, in: Proceedings of the ICML, Vol. 162, 2022, pp. 24017–24030.
- [14] D. Zou, H. Peng, X. Huang, R. Yang, J. Li, J. Wu, C. Liu, P. S. Yu, Se-gsl: A general and effective graph structure learning framework through structural entropy optimization, in: Proceedings of the ACM Web Conference 2023, 2023, pp. 499–510.
- [15] F. Harary, G. Gupta, Dynamic graph models, Mathematical and Computer Modelling 25 (7) (1997) 79–87.
- [16] M. Rosvall, C. T. Bergstrom, Maps of random walks on complex networks reveal community structure, Proceedings of the national academy of sciences 105 (4) (2008) 1118–1123.
- [17] V. D. Blondel, J.-L. Guillaume, R. Lambiotte, E. Lefebvre, Fast unfolding of communities in large networks, Journal of Statistical Mechanics: Theory and Experiment 2008 (10) (2008) P10008.
- [18] V. A. Traag, L. Waltman, N. J. Van Eck, From louvain to leiden: guaranteeing well-connected communities, Scientific reports 9 (1) (2019) 5233.
- [19] S. Fortunato, Community detection in graphs, Physics Reports 486 (3-5) (2009).
- [20] U. Brandes, M. Gaertler, D. Wagner, Experiments on graph clustering algorithms, in: European symposium on algorithms, Springer, 2003, pp. 568–579.
- [21] P. W. Holland, K. B. Laskey, S. Leinhardt, Stochastic blockmodels: First steps, Social networks 5 (2) (1983) 109–137.
- [22] A. Hagberg, P. Swart, D. S Chult, Exploring network structure, dynamics, and function using networkx, Tech. rep. (2008).
- [23] A. G. Hawkes, Spectra of some self-exciting and mutually exciting point processes, Biometrika 58 (1) (1971) 83–90.
- [24] Y. Zuo, G. Liu, H. Lin, J. Guo, X. Hu, J. Wu, Embedding temporal network via neighborhood formation, in: Proceedings of the SIGKDD, 2018, pp. 2857–2866.
- [25] A. Grover, J. Leskovec, node2vec: Scalable feature learning for networks, in: Proceedings of the SIGKDD, 2016, pp. 855–864.
- [26] J. Leskovec, J. Kleinberg, C. Faloutsos, Graphs over time: densification laws, shrinking diameters and possible explanations, in: Proceedings of the eleventh ACM SIGKDD international conference on Knowledge discovery in data mining, 2005, pp. 177–187.
- [27] D. A. Bader, H. Meyerhenke, P. Sanders, D. Wagner, Graph partitioning and graph clustering, Vol. 588, American Mathematical Society Providence, RI, 2013.
- [28] B. Viswanath, A. Mislove, M. Cha, K. P. Gummadi, On the evolution of user interaction in facebook, in: Proceedings of the 2nd ACM workshop on Online social networks, 2009, pp. 37–42.
- [29] G. Csardi, T. Nepusz, The igraph software, Complex syst 1695 (2006) 1–9.
- [30] P. ERDdS, A. R&wi, On random graphs i, Publ. math. debrecen 6 (290-297) (1959) 18.
- [31] G. Bianconi, Entropy of network ensembles, Physical Review E 79 (3) (2009) 036114.
- [32] K. Anand, G. Bianconi, Entropy measures for networks: Toward an information theory of complex topologies, Physical Review E 80 (4) (2009) 045102.
- [33] S. L. Braunstein, S. Ghosh, S. Severini, The laplacian of a graph as a density matrix: a basic combinatorial approach to separability of mixed states, Annals of Combinatorics 10 (3) (2006) 291–317.
- [34] H. Zenil, N. A. Kiani, J. Tegnér, Low-algorithmic-complexity entropy-deceiving graphs, Physical Review E 96 (1) (2017) 012308.
- [35] H. Zenil, N. A. Kiani, A. A. Zea, J. Tegnér, Causal deconvolution by algorithmic generative models, Nature Machine Intelligence 1 (1) (2019) 58–66.
- [36] H. Zenil, N. A. Kiani, F. Marabita, Y. Deng, S. Elias, A. Schmidt, G. Ball, J. Tegner, An algorithmic information calculus for causal discovery and reprogramming systems, Iscience 19 (2019) 1160–1172.
- [37] X. Zeng, H. Peng, A. Li, Effective and stable role-based multi-agent collaboration by structural information principles, in: Proceedings of the AAAI conference on artificial intelligence, Vol. 37, 2023, pp. 11772–11780.
- [38] Y. Cao, H. Peng, Z. Yu, P. S. Yu, Hierarchical and incremental structural entropy minimization for unsupervised social event detection, in: Proceedings of the AAAI conference on artificial intelligence, 2024, pp. 1–9.
- [39] P.-Y. Chen, L. Wu, S. Liu, I. Rajapakse, Fast incremental von neumann graph entropy computation: Theory, algorithm, and applications, in: Proceedings of the ICML, 2019, pp. 1091–1101.
- [40] X. Liu, L. Fu, X. Wang, C. Zhou, On the similarity between von neumann graph entropy and structural information: Interpretation, computation, and applications, IEEE Transactions on Information Theory 68 (4) (2022) 2182–2202.
- [41] X. Liu, L. Fu, X. Wang, Bridging the gap between von neumann graph entropy and structural information: Theory and applications, in: Proceedings of the WWW, 2021, pp. 3699–3710.