# Location-Aware Measurement for Cyber Mimic Defense: You Cannot Improve What You Cannot Measure
## 3 Network Partitioning  
In this section, we discuss the necessity of performing network partitioning on complex networks for evaluating CMD and present how to utilize the Louvain algorithm for network partitioning. Due to the immense scale of modern networks, conducting an evaluation of CMD technology from a global perspective in complex network environments is often imprecise and challenging. The location of attacker intrusions is random and unpredictable, and the effective coverage of CMD technology typically cannot encompass the entire large-scale network. This means that attacks conducted outside the effective range of CMD may remain largely unaffected. If an overall improvement in security is observed from global evaluation metrics, it could lead to misjudgments about the effectiveness of CMD technology. Therefore, it is necessary to adopt a divide-and-conquer approach, evaluating the effectiveness of CMD technology within smaller regions to enhance the accuracy and applicability of the metrics. As mentioned in Section 2.2, there is significant heterogeneity in the connections between nodes in real-world networks. This often leads to the aggregation of nodes, forming communities within the network. Community structure is one of the essential features of complex networks [15]. Each module or community is composed of closely connected individuals due to similar structural characteristics and positions. Community detection methods are specifically designed to partition the internal structure of complex networks with the goal of grouping network nodes into tightly connected communities. Compared to other traditional methods, community detection methods pay more attention to the patterns of connections between nodes, allowing for better capture of the local structural characteristics of the network. We utilize a typical community detection algorithm, the Louvain algorithm, to partition complex networks, which is described in detail below. The Louvain algorithm [16] is grounded in multilevel optimization of modularity, offering the advantage of speed and accuracy in obtaining a hierarchical community structure with approximately linear time complexity. It takes a heuristic approach to maximize the local modularity of smaller communities, joining only if such aggregation leads to an increase in modularity. It is the preferred method for clustering (community detection) of complex networks [17] and was rated as one of the best community detection algorithms by [18]. Two key concepts are integral to the algorithm: modularity \(Q\) and modularity gain \(\Delta Q\)[16], for which we provide the relevant formulas below. * Modularity (\(Q\)) \[Q=\sum_{C}[\frac{\sum_{in}}{2m}-(\frac{\sum_{tot}}{2m})^{2}],\] (1) where m denotes the total number of edges in the graph, \(\sum_{in}\) denotes the sum of the weights of the edges interconnected within community \(C\), and \(\sum_{tot}\) denotes the sum of the weights of the edges connected to the nodes of community \(C\), including the edges inside the community as well as the edges outside the community. * Modularity gain (\(\Delta Q\)) \[\Delta Q(i\to C) =[\frac{\sum_{in}+k_{i,in}}{2m}-(\frac{\sum_{tot}+k_{i}}{2m})^{2}]-\] \[[\frac{\sum_{in}}{2m}-(\frac{\sum_{tot}}{2m})^{2}-(\frac{k_{i}}{2 m})^{2}]\] \[=\frac{1}{2m}(k_{i,in}-\frac{\sum_{tot}k_{i}}{m}),\] (2) where \(k_{i}\) denotes the sum of the weights of the edges connected to node \(i\) and \(k_{i,in}\) denotes the sum of the weights of the edges of node \(i\) connected to the nodes in community \(C\). The main flow of the Louvain algorithm is as follows:  
1. Initially, each node is regarded as a separate community;
2. For each node \(i\), try to assign it to a neighbor community in turn and calculate the modularity gain \(\Delta Q\) after assignment, find the assignment method with the maximum modularity gain and assign it if its \(\Delta Q>0\), otherwise leave it unchanged;
3. Repeat the steps in 2 until the communities in which all nodes are located no longer change;
4.