# Cluster Head Selection Method for Edge Computing WSN Based on Improved Sparrow Search Algorithm
## 1 Introduction  
In recent years, the rapid development of wireless network technology has made the Internet of Things (IoT) important in people's productivity and life [1]. There is a wide range of sensor nodes distributed in the IoT, and they connect and communicate with each other to form a wireless sensor network (WSN), which plays an essential role in data collection and monitoring in the IoT [2, 3]. However, with the rapid increase in devices connected to the network, cloud computing can no longer meet the low-latency computing requirements of these devices, and edge computing has been proposed [4]. Edge computing is a new type of network architecture. Because it is closer to the user end, it has low latency and high efficiency compared with cloud computing, and it also reduces bandwidth pressure [5, 6]. At present, edge computing is widely used in WSNs. By using edge computing technology, it can effectively reduce the delay of WSN, improve the life of the network, and enhance the real time and reliability of the entire network system [7, 8, 9].  
However, the energy of WSN nodes is still limited, and researchers have to consider designing some energy-saving routing protocols to reduce the energy consumption of WSN nodes [10]. By clustering WSN nodes, the energy consumption of nodes can be effectively reduced, and the network lifetime can be extended [11, 12]. Usually, after the WSN nodes are clustered, a cluster head node is selected in each cluster to collect node data in the cluster and complete the transmission. Therefore, the quality of clusters and the selection of cluster heads will have a crucial impact on the performance and lifetime of the network [13, 14].  
In the work of this paper, to solve the problems of excessive energy consumption of nodes and short network life cycle caused by unreasonable clustering in the clustering routing protocol, we propose an optimization model of a two-layer WSN based on edge computing and an improved sparrow search algorithm is used to complete clustering. For the optimization problem, we use an improved sparrow search cluster head selection method, including chaotic initialization, sine-cosine mutation, and adaptive factor,to improve the network life cycle and wireless sensor network performance. The main contributions of this work are as follows:  
1. We propose a two-layer WSN system based on edge computing and establish an optimization model of a two-layer WSN based on edge computing;
2. According to the optimization model of the two-layer WSN based on edge computing, we construct an optimization objective function to balance the load and distance factors in the clustering process;
3. To solve the proposed problem, we adopt an improved sparrow search algorithm, which effectively improves the life cycle of the WSN.  
The rest of this paper is organized as follows: Section 2 introduces the current research on clustering protocols for WSNs; Section 3 describes the system model and explains the problem model for clustering optimization in WSNs; Section 4 introduces the improved algorithm; Section 5 presents the simulation and comparison results; finally, Section 6 concludes the paper.