# Identify Road Clusters with High-Frequency Crashes Using Spatial Data Mining Approach
## 2 Methodology
### Methods
#### 2.3.2 SWMR Construction Algorithm  
A spatial weight matrix (SWM) is a representation of the spatial structure of the data, and it is designed to generate, store, reuse, and share the conceptualization of the relationships among a set of features [36]. A SWM is the key input parameters in cluster and outlier analysis. The input SWM directly determines the correctness of the calculation results of cluster and outlier analysis. Consequently, when using an inappropriate SWM, cluster and outlier analysis cannot be trusted in general. As taking linear roads as the research object in this paper, we need to build the SWMR that matches with spatial distribution characteristics of roads for identification of RCHC by using cluster  
Figure 3: Structure of crash spatial aggregation algorithm. and outlier analysis. Conceptually, the SWMR is an NxN matrix (as shown in Equation (1) [26; 27]. There is one row for every road and one column for every road. \[\text{SWMR}= \begin{array}{cccccc}&1&2&j&n\\ 1&W_{11}&W_{12}&W_{1j}&W_{1n}\\ 2&W_{21}&W_{22}&W_{2j}&W_{2n}\\ i&W_{i1}&W_{i1}&W_{ij}&W_{in}\\ n&W_{n1}&W_{n2}&W_{nj}&W_{nn}\end{array}  \tag{1}\]  
where N is the number of roads; \(i,j\) is the unique identifier of roads; and \(W_{ij}\) is the weight of matrix (means the cell value for any given row \(i\) and column \(j\) combination) that quantifies the spatial relationship between roads. Typically, \(W_{ij}\) in SWMR are defined using Euclidean distance measurements and contiguity, fixed, or inverse distance weighting schemes [37; 38]. However, road traffic system with crashes is based on road network which has complex topology and geometric relationships [39; 40]. For identification of RCHC, defining spatial relationships in terms of road network is more appropriate. SWMR models road spatial relationships and should follow the topology between roads that are restricted to the adjacency of road network. At the most basic level, there is a binary strategy for creating \(W_{ij}\) to quantify the spatial relationships among roads. If the road \(i\) is a 1 st-order neighbor to road \(j\) in the road network, then \(W_{ij}=1\), else then \(W_{ij}=0\). In this paper, we consider topological or geometric adjacency roads, which share the same intersection or the same node, equal to 1 st-order neighbors. That means there is a topological or geometric adjacency between road \(i\) and road \(j\), then \(W_{ij}=1\); otherwise, \(W_{ij}=0\) using binary strategy. However, to find the geometric or topological adjacency roads is a difficult problem since the different road types (e.g., highway, local, bridge, and tunnel) in real road network have complex topological and geometric relationships. Note that roads with an overpass crossing or underpass crossing lack a true intersection. For instance, Hull Ave and I235 highway have two intersections in the 2D map; however, they do have two overpass crossings (nonintersecting) in the photo, as shown in Figure 4.  
In GIS, there are different ways to model the topological and geometric relationship of road network in real world. A total of 11 kinds of graphs were summarized in this paper, as shown in Figure 5, to demonstrate the typical topological and geometric relationships of road network. Considering the typical topological and geometric relationships of road network, we can find the geometric or topological adjacency roads to calculate spatial weights of SWMR:  
* The spatial weights of SWMR are 1 if the roads are topological adjacent for the following cases. (a) T-intersection with node, (c) T-intersection of highway bridge with node, (f) cross-intersection  
Figure 4: Overpass crossing (nonintersecting) of the highway and local road. with node, (j) topological adjacency, (k) topological adjacency with bridge, and (l) topological adjacency with tunnel. * The spatial weights of SWMR are 1 if the roads are geometric adjacent for the following cases. (b) T-intersection without node, (d) T-intersection of highway bridge without node, and (e) cross-intersection without node.