1. Introduction
Research on anomaly detection in graph networks has increasingly focused on the development of adaptive and real-time solutions capable of handling complex streaming graph data [
1,
2]. Anomaly detection is an important task in both static and dynamic networks. Unlike static networks, where the topology remains constant, dynamic networks are continuously (or periodically) changing their nodes and edges [
2].
Figure 1 illustrates two graph representations: (a) a static graph,
G, and (b) presents a snapshot of the evolving dynamic graph (
). The need for real-time graph-based detection algorithms tailored to dynamic graphs is critical for addressing diverse real-world challenges. These applications span network intrusion prevention [
3], fraud detection in financial transactions [
4], drug discovery and motif discovery in biological networks, power grid monitoring [
5], and machine learning-based vulnerability categorization [
6]. The wide-ranging applicability of these methods reinforces the importance of adaptive machine learning models in tackling real-world problems and highlights the growing demand for innovative approaches to anomaly detection in dynamic graph settings.
Existing graph-based anomaly detection methods in the literature focus more on static graphs [
7,
8]. However, graph-based approaches still face significant limitations when it comes to inductive learning and adapting to the evolving nature of real-world graphs [
2], where edge connections and node importance can change rapidly.
Among the proposed methods for anomaly detection in dynamic graphs, these can be categorized into matrix factorization and tensor decomposition, probabilistic models, distance-based methods, and deep-learning graph embeddings [
2]. Despite their respective successes, these techniques often face limitations in terms of speed, accuracy, adaptability to concept drift, and scalability. Detecting anomalous network behaviors in real-world critical infrastructures, such as power grids and nuclear plants, necessitates prompt responses with maximum accuracy.
1.1. Hypothesis and Research Questions
Given a large, time-evolving graph stream, , where structural changes occur dynamically across timestamps, t, can we develop an adaptive, near-real-time, and scalable anomaly detection framework that leverages an adaptive decay factor with Bayesian updating to effectively detect anomalous patterns with high precision and robustness.
We aim to address the following questions in our work:
Q1: Can we detect sudden changes in dynamic graphs, including node insertions, edge formations, and structural deviations, with high precision while minimizing false positives?
Q2: Can we ensure scalability in real-time anomaly detection for high-velocity graph streams while maintaining low computational overhead.
1.2. Contributions
In this paper, we propose
Adaptive-DecayRank, a novel real-time and adaptive anomaly detection model for dynamic graphs. This model utilizes a modified version of the dynamic PageRank algorithm [
9] tailored to adapt and continuously update node scores based on recent structural changes in the graph. In
Adaptive-DecayRank, we introduced a novel
decay factor formula with Bayesian updating; this was inspired by the “
Weight Decay Regularization in ADAM.” [
10], where the authors propose decoupling gradient-based updates from weight decay in both the SGD [
11] and Adam [
12] optimizers. The
decay factor in
Adaptive-DecayRank is strategically incorporated into the dynamic PageRank algorithm and is dynamically adjusted based on the observed changes of edge influx at each time step of the graph, utilizing a Bayesian updating mechanism.
The decay factor formula determines how quickly past information (nodes and edges) is discounted, allowing the algorithm to react swiftly to recent changes. By incorporating Bayesian updating inference, our model dynamically adjusts the decay factor for each node based on observed changes in node scores. This ensures that nodes with rapid changes in connectivity receive higher scores, reflecting their increased importance and potential anomalous behavior.
The motivation behind Adaptive-DecayRank lies in its ability to capture abrupt structural alterations in dynamic graph networks using the adaptive decay mechanism. We consider anomalous behavior as sudden changes in the structural composition of node scores, specifically the rapid addition of new edges between unrelated nodes as these networks evolve over time. For example, a sudden increase in node scores might signify a surge in activity, suggesting a noteworthy event or a potential security threat.
Our contributions are summarized as follows:
We introduce Adaptive-DecayRank, a modified dynamic PageRank with a Bayesian updating mechanism and an adaptive decay factor for fast anomaly detection and real-time adaptation to graph changes.
We demonstrate that our Adaptive-DecayRank prioritizes recent edge changes and assigns higher anomaly scores to structural deviation, thereby improving detection accuracy.
We conducted extensive experiments on real-world dynamic graph datasets, demonstrating that Adaptive-DecayRank outperforms state-of-the-art baselines in both precision and AUC while maintaining competitive runtime performance.
2. Related Work
In this section, we review existing methods for detecting anomalies in dynamic graphs. We categorize these methods into four groups based on their algorithmic structures. For a more comprehensive understanding of anomaly detection in dynamic graphs, we refer readers to the following reviews [
1,
2].
Distance and similarity-based methods measure similarities between nodes using time-evolving metrics to detect anomalies. Common metrics include PageRank [
13] and Betweenness Centrality [
14]. However, these similarity-based methods rely on static graphs, making them less effective in capturing real-time changes in dynamic graphs. The concept of ranking nodes by their importance or influence has been extensively studied in network science. Lü et al. [
15] provide a comprehensive review of node centrality measures, including various personalized PageRank (PPR) [
16] approaches, which have also been adapted for anomaly detection in dynamic graphs. Many methods in this category focus on identifying vital nodes to maximize influence propagation (for example, in social networks or epidemic spreading models [
17]), but their applicability to streaming anomaly detection remains limited due to computational constraints. SedanSpot [
18] is a randomized algorithm for detecting sparsely connected edges and identifying anomalies based on edge occurrence. However, SedanSpot processes input streams linearly, making it highly computationally expensive. In contrast, our method scales efficiently on large graphs in seconds. GBAD [
19] leverages the Minimum Description Length (MDL) principle and a probabilistic approach to detect graph-based structural anomalies. AnomRank [
20] applies personalized PageRank to capture both structural and edge-weight anomalies. However, in contrast to our method, AnomRank computes a global PageRank score, which does not scale efficiently for edge streaming processing. Holme and Saramäki [
21] introduced the concept of “Temporal Networks”, which highlights the challenges of detecting anomalies in streaming graphs with evolving nodes and edges. In contrast, our work focuses on anomaly detection in dynamic graphs; temporal networks provide a strong theoretical foundation for understanding evolving structures. SnapSketch [
22] is a sketch-based approach; however, it struggles with detecting sudden structural changes in dynamic graphs, a limitation our method addresses by incorporating adaptive sensitivity to micro-changes in evolving graph states. DYNWATCH [
5] uses the Line Outage Distribution Factors (LODFs) sensitivity measure for real-time detection in power grid sensors. DYNWATCH constructs a graph from active grid devices such as nodes and performs temporal weighting based on graph distances for anomaly detection. However, DYNWATCH relies on predefined sensitivity measures like LODF, making it less adaptive to dynamic network topologies beyond power grids. DynAnom [
23] is a method to track node-level and graph-level anomalies using personalized PageRank (PPR) in large graphs. It dynamically weights node representations to reflect evolving graph structures. However, it is limited by its reliance on PPR, which can introduce bias toward high-degree nodes and is less effective in capturing rapid structural changes in graphs.
Probabilistic methods use probabilistic models to represent neighborhood relationships in graphs. RHSS [
24] employs Count-Min sketches to approximate graph properties and generate probabilistic error bounds on each edge outlier scoring function. However, RHSS has a limitation in its reliance on fixed probabilistic bounds, which may lead to overestimation or underestimation of anomaly scores due to hash collisions. In contrast, our method not only captures evolving patterns but also adjusts node importance scores in real time. PENminer [
25] explores the persistence of activity snippets in edge streams, which is relevant for short sequences of recurring edge updates; however, it is not equipped to detect subgraph- or graph-level anomalies. MIDAS-R [
26] detects microcluster anomalies in edge streams using Count-Min Sketches (CMSs) to track the frequency of edge occurrences at each timestamp and, subsequently, utilizes the Chi-squared test to assess the extent of deviation from typical edges in order to calculate anomaly scores. F-FADE [
27] discovers anomalies by estimating edge patterns using the maximum likelihood rule of observed instances for each incoming interaction, while AnoEdge [
28], an extension of MIDAS-R, focuses on higher-order sketches. However, these methods (F-FADE, MIDAS-R, and AnoEdge) require high computational time for large graph streams and primarily target the detection of edge-level or subgraph-level anomalies. In contrast, our method captures both node-level and structural anomalies in real time, offering a more comprehensive approach to anomaly detection in dynamic graph streams.
Matrix factorization methods decompose high-dimensional matrices into lower-dimensional forms, revealing evolving patterns in graphs. Recent methods include EdgeMonitor [
29], an edge-detection approach that models dynamic graph evolution as a first-order Markov process. However, a major drawback is its reliance on consistent node ordering across all time steps, and it assumes a constant number of nodes per snapshot, which is often violated in large-scale graphs. DenseAlert [
30] is an incremental and continuously updating method for detecting dense subtensors in tensor streams. LAD [
31] applies the Laplacian spectrum for change detection by computing the singular value decomposition (SVD) of the graph Laplacian to obtain a low-dimensional graph representation. MultiLAD [
32] generalizes LAD to multi-view graph detection. Despite the successes of matrix factorization-based methods like EdgeMonitor, DenseAlert, LAD, and MultiLAD, these approaches are computationally intensive, require manual extraction of graph properties, and are highly susceptible to noise. In contrast,
Adaptive-DecayRank dynamically updates node scores in real time without requiring global recomputation, ensuring scalability and efficiency for large-scale graph streams.
Deep graph learning methods leverage neural networks to extract and learn graph representations. H-VGRAE [
33] employs graph autoencoders for embedding and node-level detection, constructing a hierarchical model by combining a variational graph autoencoder with a recurrent neural network (RNN). ROLAND [
34] extends classical graph neural networks (GNNs) to capture dynamic graph structures by leveraging a hierarchical node state update mechanism. It allows static GNNs to be adapted for dynamic graphs using recurrent updates and an incremental training approach. However, ROLAND and other deep learning approaches, such as H-VGRAE, assume that node embeddings can be incrementally updated without complete recomputation, leading to information loss over long sequences. In contrast, Adaptive-DecayRank is designed for real-time anomaly detection in dynamic graphs. Unlike deep learning-based methods, it does not require retraining from scratch or extensive hyperparameter tuning, making it computationally efficient and scalable for large graph streams. Additionally, Transformer models, such as Graphomer [
35] and TADDY [
36], have also been utilized for dynamic graph representation learning. However, these methods face limitations when dealing with highly irregular and evolving topologies, as they often struggle to capture local structural dependencies efficiently.
In summary, our method,
Adaptive-DecayRank, addresses a broader range of anomalies by detecting both node-level and structural anomalies in streaming graphs.
Adaptive-DecayRank aligns with distance-based and similarity-based approaches, leveraging dynamic PageRank with a
decay factor and
Bayesian updating as a similarity metric to assign node importance scores and conduct structural analysis. The dynamical Bayesian updating incorporated in our algorithm tracks micro-changes in edges at each timestamp, leading to faster and more accurate detection compared to existing methods in the literature, which are computationally intensive and slow to adapt to sudden deviations in dynamic graphs. We provide a summary of our method’s properties compared to existing approaches in
Table 1.
3. Background
In this section, we present some definitions related to dynamic graphs, and review the personalized PageRank algorithm. Additionally, we outline the problem formulation of our anomaly detection method. The complete set of notations is provided in
Table 2.
Definition 1. A graph, , is defined as a pair consisting of a set of nodes, , and a set of edges, E, which is a subset of the Cartesian product and defines the connections between the nodes.
Definition 2. A weighted graph, , is a graph where each edge has an associated weight, .
Definition 3. A graph snapshot at a specific timestamp, t, is denoted as , where is the set of nodes present at time t, and is the set of edges existing between the nodes in at time t; represents the weights assigned to the edges in , which may consist of plain or labeled edges.
Definition 4. We define dynamic graph, , as a sequence of ordered sets of graph snapshots at different timestamps, t, where T is the total time steps, and each is a static graph representing the state of the graph at timestamp t.
3.1. Personalized PageRank and RWR
The PageRank algorithm [
13] assigns scores to web pages, treating the web as a directed graph with pages as nodes. Variants like Random Walk with Restarts (RWRs) [
37] have been developed for specific tasks. The standard representation of the personalized PageRank vector,
[
16], for the source node
u is calculated as follows:
where
is the column stochastic transition matrix, which can be further expanded as
. The parameter
is the adjacency matrix, and
is the degree matrix of a given graph,
, with
n nodes.
is the indicator (restart) vector for node
u (i.e., the teleport vector), and
represents the stationary probability distribution over all nodes, indicating the likelihood of being at any node in the graph after many random walk steps. The parameter
is the
damping factor, representing the probability that the random walker follows an edge rather than teleporting, and it is commonly set to
.
The personalized PageRank is commonly solved using power iteration and iterative refinement until the probability that a random walker navigates the graph converges to the personalized importance scores assigned to each node.
3.2. Dynamic PageRank Variant
Our method extends the Dynamic PageRank [
9] variant to effectively handle real-time anomaly detection in graph streams by incorporating temporal adaptability for real-time updates. Traditional PageRank algorithms often fail to address challenges in dynamic graphs, such as high-frequency updates, computational overhead, and the temporal decay of node relevance.
These properties make Dynamic PageRank particularly well-suited for dynamic graphs, where the current node importance score,
, can be updated incrementally from previous scores,
, based on recent structural changes in the graph. This adaptability is especially critical in applications like intrusion detection and critical cyber-infrastructure monitoring, where edge or node insertions and deletions often signify anomalies or potential cyber-threats [
2], requiring immediate attention.
For example, consider a coordinated Distributed Denial-of-Service (DDoS) attack, where multiple computers collectively exhibit malicious behavior or a social network where a user’s connections fluctuate daily. A standard PageRank algorithm treats the graph as static, missing short-term or evolving trends, such as a sudden influx of connections indicative of spam activity. Personalized Dynamic PageRank variants, like our proposed model, capture this behavior by incrementally updating scores with temporal decay (i.e., the gradual reduction in the influence of older node or edge interactions over time), thereby enabling timely anomaly detection. The formula to compute the dynamic PageRank score is shown below:
Equation (
2) follows directly from Equation (
1), where
is the stochastic transition matrix, defined as
. This matrix depends on the graph’s structure at each time step,
t. The parameter
c is the damping factor, and the indicator probability vector,
, allows the teleport vector to vary over time.
This formulation enables incremental updates to the PageRank scores upon the insertion or deletion of edges, making it highly suitable for practical downstream tasks such as graph learning. Previous studies [
9,
23] have demonstrated that Dynamic PageRank performs effectively on graphs, establishing it as a robust scoring function for detecting node-level structural anomalies in dynamic graphs.
3.3. Problem Formulation
Before outlining our specific node-level problem, we first define a node-level structural anomaly in a dynamic graph.
Definition 5 (Node-level Structural Anomaly).
Given a dynamic weighted graph, , consisting of the initial snapshot, , where is the set of nodes, is the set of edges, and is the set of edge weights at time t. The total node set is , and the total edge set is . Each snapshot can have changes in edge events, , and changes in node events, . Let be a specified scoring function. The set of anomalous nodes, , is defined such that , , where is a summary statistic of the score , and is a predefined threshold indicating a significant deviation.
Problem 1. Detect node-level structural anomalies in . Specifically, a node, , is considered anomalous at time if it experiences a significant deviation characterized by a sudden transition in its connectivity, i.e., from its original set of outgoing edges to neighbors, , to a new set, .
In Problem 1,
is defined as a substantial change in the set of a node’s neighbors,
, as shown in Equation (
3):
where
is the set of neighbors of node
at time
. A
sudden transition occurs when
exceeds a predefined threshold,
, indicating a notable structural shift.
Figure 2 illustrates node-structure anomalies across two graph snapshots. Sudden changes in node scores and the appearance of new edges could indicate potential cyber-attacks on computer networks or a series of fraudulent transactions. Intuitively, to detect such structural anomalies, our approach focuses on the existence of edges connecting nodes rather than the frequency of edge occurrences between them. Additionally, we consider the rapid occurrence of these edges (insertion or deletion) with fast adaptiveness and, ultimately, an optimized vector score for each node in the dynamic graph.
4. Proposed Method
In this section, we present our previous work, the
DecayRank algorithm [
38], along with our novel
Adaptive-DecayRank algorithm. These approaches incorporate a dynamic node scoring function, an adaptive decay factor enhanced with Bayesian inference, and an anomaly detection metric. The components are illustrated in
Figure 3 and are discussed in detail in
Section 4.2.
In
Figure 3, the
Adaptive-DecayRank framework begins by transforming the dynamic graph input into snapshots based on timestamps, which serve as the foundation for node score computations. The algorithm then iteratively updates node scores while dynamically adjusting the decay factor through Bayesian inference. This adaptive approach ensures sensitivity to observed changes in the graph structure, enabling the quick detection of evolving patterns. Finally, normalized anomaly detection metrics are applied to identify nodes exhibiting significant deviations over time. The framework emphasizes the integration of real-time updates, adaptive mechanisms, and robust anomaly detection tailored to dynamic graph environments.
4.1. Dynamic Node Scoring with Temporal Decay
Below, we provide a detailed explanation of the components of our proposed Adaptive-DecayRank algorithm, including the node scoring function and the foundation for integrating an adaptive decay factor through Bayesian inference.
4.1.1. Node Scoring Function
Traditional offline scoring functions, such as HITS (Hyperlink-Induced Topic Search) [
39] and centrality measures (e.g., Betweenness Centrality) [
14], are effective at identifying degree centrality, influential nodes, or ego nodes in static graphs [
2]. However, in an online setting, where graphs evolve over time, capturing dynamic fluctuations becomes essential.
In our previous work, the
DecayRank algorithm [
38] was introduced to assign importance scores to individual nodes by considering neighboring edges and evolving graph properties. Based on the iterative formula in Equation (
2),
DecayRank incorporates a
fixed decay factor to dynamically adjust scores at every iteration. While effective, this fixed decay factor posed limitations in adapting to varying graph dynamics, an issue addressed by the proposed
Adaptive-DecayRank algorithm. The modified node score vector,
, for
DecayRank is defined as
Here,
is the row-normalized adjacency matrix, and the other parameters follow the notation in Equation (
2). The temporal decay function,
, reduces the influence of older interactions, with the decay factor,
, controlling the rate of decay. The term
represents the most recent timestamp when node
u was last updated in the adjacency structure of the graph. Specifically, it is derived from the adjacency structure,
, which maintains historical interaction records of node
u. This ensures that more recent interactions contribute more significantly to the node score, while older interactions decay exponentially over time.
4.1.2. Temporal Decay Factor
The concept of our proposed novel
adaptive-decay factor formula is inspired by the work on “
Weight Decay Regularization in the ADAM Optimizer” [
10], where the authors propose decoupling gradient-based weight updates in both the SGD [
11] and Adam [
12] optimizers.
In Equation (
4), we introduced the temporal decay function
, which enhances the adaptability and responsiveness of our algorithm. The parameter
, referred to as the
decay factor, controls the rate at which the influence of an edge or node decreases over time. A higher
value results in faster decay, gradually reducing the impact of older interactions or edges. This ensures that older data have progressively less influence on the computation of new graph snapshots and allows the algorithm to prioritize recent and relevant changes in the graph structure. The variable
represents the current timestamp, while
denotes the timestamp attribute of node
. The term
calculates the time difference between the current timestamp and the last update of node
.
Algorithm 1 provides a summary of our previous work on the DecayRank algorithm, which employs a fixed decay factor. While effective, this fixed factor struggles to adapt to the varying dynamics of individual nodes, potentially resulting in suboptimal anomaly detection and reduced sensitivity to recent changes in the graph.
To overcome these limitations, we propose the
Adaptive-DecayRank algorithm, which utilizes a Bayesian updating mechanism to dynamically adjust the decay factor in response to observed changes in node rank scores. This adaptive approach not only enhances the algorithm’s responsiveness to evolving graph structures but also significantly improves the accuracy and robustness of anomaly detection in dynamic and near real-time graph environments.
Algorithm 1 DecayRank: Streaming Anomaly Scoring |
Input: A: Array of dynamic graph outEdges over time Output: : Updated PageRank scores
- 1:
Initialization: - 2:
Initialize PageRank values for all nodes i - 3:
while each timestep from 0 to do ▷ Power Iteration: - 4:
Update scores based on graph structure. ▷ Decay Factor Application: - 5:
Apply decay factor to adjust scores over time. ▷ Update PageRank Scores: - 6:
Integrate new scores: - 7:
end while ▷ Normalization Anomaly Score: - 8:
return normalizeNodeScore()
|
4.2. Adaptive-DecayRank Algorithm with Bayesian Updating
Next, we describe our Adaptive-DecayRank algorithm, which incorporates a dynamic scoring function with adaptive decay factors for responsive updates based on graph changes, along with a Bayesian updating mechanism for further refinement. The Adaptive-DecayRank algorithm extends our previous DecayRank approach. This innovation enables the algorithm to dynamically adapt to real-time changes in graph structures, ensuring robustness and accurate anomaly detection in dynamic graph settings.
4.2.1. Bayesian Inference and Updating
The
Adaptive-DecayRank algorithm utilizes Bayesian inference [
40] to dynamically adjust decay factors, enabling responsive updates to evolving graph structures. Unlike frequency-based approaches, which rely on fixed parameters and repeated sampling, Bayesian inference treats probability as a measure of belief, updating prior distributions in light of new data and observed changes. This makes it well-suited for dynamic, evolving systems such as graphs.
Bayesian inference involves three key steps: (1) The prior distribution, , which represents initial beliefs about the parameter (in this case, the decay factor ) before observing any data. (2) The likelihood function, , expressed as , captures the probability of observing data, X, given a specific value of . This function reflects how well explains the observed data. Finally, (3) the posterior distribution, , which combines the prior and likelihood to update our beliefs about after observing data X.
Using Bayes’ theorem, the posterior is defined as
where
is the posterior distribution (updated belief about
),
is the likelihood function defined as
, and
is the normalizing constant ensuring the posterior is a valid probability distribution.
4.2.2. Bayesian Updating in Adaptive-DecayRank
In the context of
Adaptive-DecayRank, Bayesian inference is employed to update the decay factor,
, for each node,
. The Gamma distribution is used as a conjugate prior, ensuring computational efficiency and tractability during updates on the observed changes in node scores. The probability density function of the
prior Gamma distribution for
is defined as
where
is a continuous variable taking non-negative values,
,
is the
shape parameter that controls the shape of the distribution,
is the
rate parameter that controls the scale of the distribution, and
is the Gamma function, which generalizes the factorial function.
4.2.3. Adaptive and Dynamic Scoring Function
The
Adaptive-DecayRank formula with Bayesian updating is defined in Equation (
7). The Gamma distribution parameters
and
in Equation (
6) represent our prior beliefs about the decay factors. For each iteration, the algorithm observes and adjusts node scores based on the recent changes. The scoring function is given by
where
is the updated score for node
u at iteration
,
is the damping factor controlling the influence of neighboring nodes,
is the transition probability matrix,
is the node score for
at iteration
,
is the personalization vector capturing the inherent importance of node
u,
is the decay factor for node
u, dynamically updated using Bayesian inference, and
is the time elapsed since the last update of node
u.
In Equation (
7), the term
represents dynamic PageRank propagation, and the adaptive temporal decay is represented with the expression
, emphasizing recent interactions and diminishing the influence of older data.
Posterior updates: Equation (
6) shows the prior distribution for
; that is, the conjugate prior, ensuring efficient computation. The
adaptive decay factor,
, is computed as the mean of the posterior Gamma distribution and is updated using
and
:
The
shape parameter (
) is adjusted to reflect the magnitude of observed changes, with larger changes resulting in fast updates.
The
rate parameter (
) is updated to maintain stability, preventing drastic shifts when changes are minimal:
By leveraging Bayesian inference, the Adaptive-DecayRank algorithm dynamically adjusts in real time, ensuring sensitivity to significant changes in graph structure while mitigating noise. The conjugacy of the Gamma distribution guarantees computational efficiency, enabling scalability for large-scale dynamic graphs. This approach addresses concerns about innovation, clarity, and robustness in anomaly detection for dynamic graphs.
4.3. Algorithm
Algorithm 2 implements the
Adaptive-DecayRank framework. The algorithm processes a dynamic graph represented by the
input, , which is an array of outEdges serving as the transition matrix. Each node maintains a list of outgoing edges, denoted as
, with corresponding weights,
, where
is the weight associated with the edge connecting to each neighboring node,
. Additionally, the last observed timestamp (denoted as
in algorithm line 5) represents the last time node
i was updated in the graph stream. In Equation (
7), this timestamp corresponds to
, which represents the last time step at which node
u was modified. For example, if node
A has outgoing edges to nodes
B and
C with weights 0.5 and 0.2, respectively, and the timestamp is 10, this implies that node
A’s connections were last updated at time step 10. The edge weights are assigned dynamically based on edge updates in the evolving graph stream, while the adaptive decay factor,
, reduces edge influence over time.
Algorithm 2 Adaptive-DecayRank: Node Anomaly Scoring |
Input: A: Array of dynamic graph outEdges, v: Array of PageRank scores, n: Number of nodes, numSteps: Streaming timesteps Output: v: Anomaly scores ▹Initialization of Parameters:
- 1:
Initialize DecayRank values for all nodes i - 2:
while each timestep from 0 to do ▹Power Iteration: - 3:
Update scores based on graph structure. ▹Applying Adaptive Decay Factor: - 4:
for to do - 5:
- 6:
- 7:
- 8:
- 9:
- 10:
- 11:
- 12:
end for ▹Dynamic Updating of DecayRank Scores: - 13:
for to do - 14:
- 15:
end for ▹Convergence Check: - 16:
if then - 17:
break - 18:
end if - 19:
end while ▹Normalization: - 20:
return normalizeDecayRank
|
The output, , is the sequence of stochastic vectors for node scores. The algorithm initializes node scores uniformly as , where c is the damping factor, and n is the total number of nodes (as shown in line 1). At each time step, the algorithm iteratively updates these scores based on the structure of using power iteration (lines 2–3).
The
adaptive-decay factor (as shown in lines 7–9) is dynamically adjusted using Bayesian inference to reflect observed changes in the graph structure, enhancing sensitivity to recent interactions while mitigating noise. The decay factor is computed as
in
line 9, where
represents the
prior update, and
represents the
posterior update, both of which are updated based on observed changes (see details in
Section 4.2.3). The scores,
, (updated in
line 14) are adjusted with the computed decay values (
), and the process continues until the
convergence criterion (
line 16–19) is satisfied. In
line 16, the EPSILON is set to
to balance accuracy and computational efficiency. After completing all iterations, the scores are
normalized as
to maintain consistency across nodes and ensure comparability, preventing high-degree nodes from dominating anomaly detection results (see details in
Section 4.4.1).
4.4. Anomaly Detection Metrics
After Algorithm 1 computes the score vectors for each node using an
adaptive decay factor, we apply similarity metrics from the work of Yoon et al. [
20] to detect anomalous behavior at each time step in the graph. The base parameter for the
Adaptive Decay Factor,
, has an empirical range of
. For stability, the tuning occurs dynamically using
Bayesian updating, where a higher decay factor reduces the influence of past edge interactions. The anomaly detection metric was first introduced and theoretically analyzed in [
20] for tracking node score variations over time. Given a score vector,
, the metric is defined as
In Equation (
11), the metric
represents the
discretization of the second-order derivative of the score vector,
. The second derivative captures
acceleration or deceleration in score changes over time, making it effective for identifying sudden shifts in node behavior that may indicate anomalies. The discretization process approximates a
continuous function in a discrete form, ensuring computational efficiency and robustness in time-evolving graphs.
The
theoretical justification is provided in [
20], where the authors established a basis for anomaly detection in dynamic graphs by modeling normal graph behavior using
Lipschitz continuity, ensuring smoothness in time-series updates. The study demonstrates that normal graph streams exhibit bounded
first- and
second-order derivatives:
, where
and
are positive real constants. Under this assumption, normal graphs exhibit gradual changes, leading to small values of
and
. However, anomaly types, such as sudden structural changes, could cause these bounds to increase significantly, making them strong indicators of anomalous behavior (
see Section 4.3 in [20] for more details and proofs).
To maintain consistency across time and balance positive and negative fluctuations, we apply centering and variance scaling, ensuring that anomaly scores remain comparable across different time steps.
4.4.1. Online Normalization
To ensure that the derivative-based metrics are robust and consistent across time steps, we normalize the
Adaptive-DecayRank scores,
, and their derivatives online by adjusting the mean,
, and variance,
, of the scores, with the inclusion of the
adaptive decay factor to emphasize recent changes:
Following Equations (
9) and (
10), the Bayesian update prior values are set to
and
. These parameters control the rate of adaptation to changes in graph structures. We set the number of iterations for
Bayesian updating to
numSteps = 10, ensuring stable convergence while capturing micro-level changes in node importance. This normalization centers the derivatives around zero and scales them to unit variance, balancing positive and negative fluctuations as well as large and small variations, thereby making anomaly comparisons across different time steps more consistent.
4.4.2. Anomaly Score Calculation
Finally, the anomaly score is computed by combining the effects of both first- and second-order derivatives:
where
is the derivatives for node
i in step
j,
is the product of the maximum derivative values across all nodes, and
is the maximum observed derivative for node
i.
To further illustrate the computation of Equation (
14), we consider a small dynamic graph with
three nodes, where each
row in the
matrix represents a node, and each column represents the derivatives of a node across three timestamps, as shown below:
From the matrix, d, the maximum derivative per node (, , ) is , and the total maximum is .
For
Node 1, the anomaly score computed as
Finally, the anomaly score is determined as follows:
This example illustrates how the anomaly score prioritizes nodes with significant derivative changes, emphasizing abnormal patterns in the dynamic graph. The final score, , reflects the anomalous behavior of the node relative to its past and to other nodes.