## 3 Materials and Methodology
### Complex Network
#### 3.3.4 Community Detection  
Complex networks are usually locally clustered and considered to be composed of different \"clusters\" depending on the density of connections between different nodes in the network. A cluster is a community structure in a network, where nodes in a cluster are more densely connected, while nodes between clusters are more sparsely connected [50]. Exploring the community structure in the interaction network of seafarers' unsafe acts and their influencing factors could help to understand the structure and function of the global network and further discover the local patterns of interaction between seafarers' unsafe acts and their influences in the network. The same pattern represents the same risk mechanism among nodes and is more likely to propagate risk than nodes outside the pattern. Commonly used community structure detection algorithms include graph partitioning-based community detection algorithm, clustering-based community detection algorithm, modularity maximization-based community detection algorithm, and random walk strategy-based community detection algorithm [51]. In this regard, the community discovery algorithm based on random walk strategy considers that random walk in the network tends to \"fall\" into the densely connected part corresponding to the community. As a result, [PERSON] and [PERSON] [52] proposed a random walk-based inter-vertex similarity measure method, which could efficiently discover the community structure of the network when there are less than 1000 nodes in the network [53]. The basic idea of the method is that short-distance random walk tends to stay in the same community. The random walk on a network \(G\) is driven by its transition matrix \(P\), which can be obtained from the adjacency matrix \(A\) of the network \(G\). The random walk of length \(t\) can be represented by the matrix \(P^{t}\), where \(P^{t}_{ij}=\left(P^{t}\right)_{ij}\) is the probability of going from \(i\) to \(j\) through a random walk of length \(t\). The parameter \(t\) should be set to make the random walk long enough to ensure that sufficient information about the network topology could be collected, but not too long to avoid reaching a balanced distribution. Then, the distances between all adjacent nodes are calculated by:  
\[r_{ij}=\|D^{-\frac{1}{2}}P^{t}_{i.}-D^{-\frac{1}{2}}P^{t}_{j.}\| \tag{16}\]where \(\parallel\). \(\parallel\) is the Euclidean norm; \(P_{i. }^{t}\) is the \(i^{th}\) row of \(P^{t}\); \(P_{j. }^{t}\) is the \(j^{th}\) row of \(P^{t}\); \(D\) is the degree matrix of nodes. When adjacent nodes belong to different communities, the \(r_{ij}\) distance is larger; conversely, the \(r_{ij}\) distance is smaller. Similarly, the distance between two different communities can be calculated by:  
\[r_{C_{1}C_{2}}=\|D^{-\frac{1}{2}}P_{C_{1}.}^{t}-D^{-\frac{1}{2}}P_{C_{2}.}^{t}\| \tag{17}\]  
where \(P_{C.}^{t}\) is the probability vector that go from community \(C\) to vertex \(j\) in \(t\) steps:  
\[P_{Cj}^{t}=\frac{1}{|C|}\sum_{i\in C}P_{ij}^{t} \tag{18}\]  
Next, two adjacent communities are selected to merge into a new community and the distance between communities is updated, and the process is repeated to minimize the change \(\Delta\sigma(C_{1},C_{2})\) between all community pairs in the current division. \[\Delta\sigma(C_{1},C_{2})=\frac{1}{n}\frac{|C_{1}||C_{2}|}{|C_{1}|+|C_{2}|}r_{ C_{1}C_{2}}^{2} \tag{19}\]  
As research progresses, many community detection methods are proposed. It is also crucial to evaluate and compare the quality of the community detection results found by these methods. [PERSON] et al. [54] proposed Modularity to evaluate the closeness of each community structure after the division of the network structure. The basic idea is that the probability of connectivity between nodes in a community is greater than the probability of connectivity between nodes in other communities.