## 3 Proposed Method
### Fog Node Location Model
\(Q_{ij}\) represents the quality of service provided by point \(j\) to point \(i\). It is a measure of how well point \(j\) serves point \(i\) in the context of the network. The service delay occurs when fog node i serves point j. \(OThr\) denotes the value at the threshold. 1. Modified density peak clustering (MDPC) algorithm. The MDPC method uses a local reachability density-based clustering strategy to improve clustering performance. The cluster head selection step of the procedure comes after the clustering phase. Cluster centers are identified by their greater density relative to nearby data points and by their relative distance from other places with higher densities. This denotes the foundation upon which the MDPC algorithm functions. For each data point, two crucial features are defined, (1) \(\sigma_{i}\) and (2) \(\tau_{i}\), in order to capture these qualities. Inherent to the clustering technique are the following qualities:  
\[\sigma_{i}=\sum_{j=1}^{n}A\big{(}d_{ij}-d_{C}\big{)}. \tag{4}\]  
\(\tau_{i}\) for a data point \(\sigma_{i}\) denotes the minimum distance to any data point \(\tau_{j}\) with a higher local density (\(\sigma\)) than \(\sigma_{i}\), but only if the stated cutoff distance \(d_{C}\) is met or exceeded by the distance \(d_{ij}\). A represents an indicator function that determines if a given distance meets this condition:  
\[\tau_{i}=\left\{ \begin{array}{lcl}Min\big{(}d_{ij}\big{)}&if&\
i j,\ s.t: \sigma_{j}>\sigma_{i}\\ Max\big{(}d_{ij}\big{)}&if&\
i j,\ s.t:\sigma_{j}<\sigma_{i}\end{array} \right. \tag{5}\]  
The number of data points closer to point i than a certain distance, \(d_{C}\), is represented by \(\sigma_{i}\). This metric offers a localized view of the probability that point I will function as a cluster center. Conversely, \(\tau_{i}\) denotes the minimal separation between point i and its closest high-density point, providing a worldwide view of the probability that point i is a cluster center. Metrics like \(\sigma_{i}\) and \(\tau_{i}\) are widely used in practice to identify various properties of clusters. Usually, cluster centers are selected at intervals when these metrics have high values. The remaining data points are then assigned to the closest cluster center in a single step once these cluster centers have been identified, ensuring accurate cluster assignments. By considering both local and global density features, this method provides a data-driven method for choosing cluster centers, which enhances the accuracy of the clustering process. The supercluster idea is shown in Figure 1.  
Following the first cluster center identification, the slave cluster heads (SCHs) must be selected. This selection process takes into account many aspects to provide the greatest possible selection of SCHs. Density, packet delivery ratio, energy level, capacity, and distance are some of these characteristics. By considering these factors, the clustering algorithm seeks to maximize the efficacy and efficiency of the cluster head selection procedure while choosing SCHs. The SCHs are better suited to their duties in the network as a result of this rigorous evaluation of several elements. A supercluster was overlaid with small clusters as part of the proposed methodology. We see the supercluster diagram in Figure 2. Slave CHs in mini-clusters collect data from nodes and forward them to the super CH via a hierarchical structure. Slave CHs also transmit data to a nearby node. This allows the network to function in a multi-hop fashion. Furthermore, a slave CH takes on the role of the cluster head as the energy of the slave node is larger than that of the cluster head. When processing the SCH proves difficult and a cluster could accommodate many vehicles, cluster splitting is used. When two clusters have a dense vehicle with identical properties, cluster merging is used. The network was also connected to fog nodes, which provided faster data processing and less energy use.