# Anomaly Detection in Blockchain Networks Using Unsupervised Learning: A Survey
## 6 Data Structures Used in Blockchain Anomaly Detection
### Graph-Based Data Structures  
Graph-based analysis and modeling has manifested itself as an effective tool in dealing with financial fraud [137]. The impetus behind this fact is the inherent capability of graph-based data structures in representing the interactions between the entities encoded in the graph yielding effective classification of these entities based on predefined features [138; 139].  
So far, the graph-based representation of blockchain data has been proven to be very effective in dealing with the limitations involved in the implementation of more traditional considerations because it supports a decentralized, scalable, and flexible way of indexing blockchain data [140]. In addition, a graph is compatible with the blockchain network structure, a fact that renders it a scalable procedure for representing the data. In a nutshell, the main benefits of using graphs in blockchain technologies are enumerated as follows [78; 139; 140]: (a) it is a scalable structure and can effectively encompass large amounts of future data, (b) it provides flexibility in terms of certain query languages, rendering querying for data retrieval a straightforward process, (c) the indexing process can be easily applied for a large amount of data, and (d) it is based on decentralized protocols favoring high-security levels.  
Figure 3 depicts two typical graph structures, namely, user graph and transaction graph, proposed by [PERSON] and [PERSON] in [78]. The user graph represents accounts as nodes with loops indicating transactions between accounts, allowing for the embedding of fund sources and destinations. On the other hand, in the transaction graph, the node represents a transaction while the edges represent the flow of funds between transactions, where the output of a transaction is taken as the input by the next one, and the weight of the edge corresponds to the transferred amount.  
The flexibility and scalability of graph-based models make them well suited for handling the complex and interconnected nature of blockchain networks. By incorporating  
Figure 3: (**a**) User graph that depicts nodes representing accounts (i.e., A, B, C) with edges indicating transactions between accounts forming a graph with loops to capture fund flow directions and (**b**) transaction graph that shows nodes as individual transactions (i.e., t1, t2, t3, t4, t5, t6) with edges representing the flow of funds between transactions, lacking closed loops due to the sequential nature of transactions in blockchain data.  
measures of graph regularity based on information theory, researchers can quantify the predictability of blockchain structures and enhance anomaly detection performance. These measures can help in identifying deviations from normal network behavior and distinguishing legitimate transactions from potentially malicious ones.  
To elaborate blockchain graph-based data for anomaly detection tasks, specialized unsupervised learning techniques are used such as the deepwalk algorithm [112], spectral clustering [113], Louvain graph-based method [114], isolation forest [120], etc. The main target of these methods is to maintain the graph's properties (e.g., the graph's structure, the features related to nodes, the features related to edges, etc.) by incorporating graph embedding mechanisms [139]. Graph-based anomaly detection offers several advantages, including intuitive pattern recognition and flexibility in analysis. However, challenges such as scalability and privacy concerns persist. Despite these challenges, the amalgamation of various graph structures presents a visually interpretable framework for securing blockchain networks. Achieving a balance between insightful analysis and adaptability is imperative for effectively safeguarding blockchain ecosystems [110].