# Local Event Detection Scheme by Analyzing Relevant Documents in Social Networks
## 3 The Proposed Local Event Detection Scheme
### Local Event Detection  
The proposed scheme performs a clustering algorithm based on edge weights in the keyword graph to classify local events. An edge weight represents the keyword correlation coefficient, which means that the higher the weight is, the more frequently co-occurring the keywords are. The clustering algorithm combines the key nodes with their one-hop neighbors that have a higher edge weight than a threshold (\(\alpha\)). The threshold is selected based on the network modularity, which embodies the strength of the division of a network  
Figure 5: Example of relevant documents. into modules (clusters). The network modularity is often used in optimization methods for detecting communities (clusters) in a graph. We use it for detecting and grouping events to efficiently find local events. The network modularity is formulated by Equation (5), where \(NM_{G}\), \(m\), \(n\), \(ew_{ji}\), and \(k_{i}\) denote the network modularity value of a graph G, the number of edges in the graph, the number of vertices in the graph, the edge weight between vertex \(i\) and \(j\) that is calculated by Equation (1), and the sum of edge weights of vertex \(i\), respectively. In Equation (5), \(\delta\big{(}c_{i},c_{j}\big{)}\) is a boolean function that returns 1 or 0 depending on whether vertex \(i\) and vertex \(j\) are in the same cluster. \[NM_{G}=\frac{1}{2m}\sum_{ij}^{n}\big{[}ew_{jj}-\frac{k_{i}k_{j}}{2m}\big{]} \delta\big{(}c_{i},c_{j}\big{)} \tag{5}\]  
The procedure of merging and splitting clusters is needed for providing \"\(k\)\" events to users, where k is the number of events that we want to get. The proposed scheme provides \"\(k\)\" clusters to users as the local event by using the in-cluster and the out-cluster weight. Figure 6 shows an example of detecting local events of the proposed scheme. First, we form clusters according to the abovementioned procedure. After that, we obtain three clusters, as shown in Figure 6. The in-cluster weight is calculated based on the average of edge weights in the cluster. The out-cluster weight is calculated based on the sum of edge weights of inter-cluster. In this example, the in-cluster weights of \(C_{1}\) and \(C_{2}\) are 0.66 and 0.53, respectively. The out-cluster weight between \(C_{1}\) and \(C_{2}\) is 1.55. We compare the sum of the in-cluster weights with the out-cluster weight. In this case, the out-cluster weight is higher than the sum of the in-cluster weights (0.66 + 0.53 = 1.19 + 1.55). Therefore, we merge \(C_{1}\) and \(C_{2}\) since \(C_{1}\) (or \(C_{2}\)) is closely related with \(C_{2}\) (or \(C_{1}\)). Likewise, we compare the sum of the in-cluster weights with the out-cluster weight between \(C_{1}\) and \(C_{3}\). The out-cluster weight is lower than the sum of the in-cluster weights (in. 0.66 + 0.74 > out. 0.40 + 0.32). Therefore, we remove the connected edges of \(C_{1}\) and \(C_{3}\). Finally, we provide users with the detected (clustered) local events as shown in Figure 6b. Algorithm 2 shows the local event detection algorithm. The input parameters are KG (the keyword graph) and k (the number of local events). The return values are the keyword sets of the detected local events. We set the threshold alpha and the output data to the initial values (Lines 1-2). We use the network modularity to find the best threshold value by using Equation (5). As already mentioned, the threshold is used for the \"\(k\)\" clustering algorithm that combines one-hop neighbors (which have a higher edge weight than the  
Figure 6: Example of detecting local events: (a) clustering; (b) detecting local events by merging and splitting clusters. threshold that is induced by the network modularity) with the key node (Line 3). Finally, we merge clusters \"a\" and \"b\" iteratively by comparing the sum of the in-cluster weights with the out-cluster weight (Line 4-13). The merged cluster is then inserted into the result E (Line 10). We return the result E as a set of the detected local events.