## 3 Problem Background  
Based on related studies, it can be seen that sensor nodes are self-configured, autonomous, unpredictable and have limited constraints. The main task of such tiny devices is to capture information from critical fields, process it, and transfer towards the sink node via wireless communication channels. As sensor nodes are restricted in terms of memory, processing and battery power, such limitations degrade the performance of the network in terms of well-timed and efficient data delivery. Moreover, the cluster heads--especially around the BS--consume their battery power more frequently than the far nodes, which results in network disconnectivity and extra cost in route reconstruction. Although, a machine learning-based algorithm has been proposed to improve the network lifetime and delivery ratio of WSNs. However, most of the proposed solutions offer only energy-efficient routing, and they leave the most significant aspects if any malicious node becomes a part of the network. In addition, data transmission failure may occur due to the selection of unreliable and low-quality links; such reasons may be harmful to network and route stability. Although some solutions have been proposed to cope with data security, key distribution is not dealt with reliably and there are no randomness in the key generation and data encryption methods. Moreover, malicious nodes may be able to generate false packets for accessing encryption keys, thus compromising network security. Most of the proposed secure solutions overlook intracluster secure communications, which leads to malicious nodes becoming the part of a cluster and being able to steal information. Furthermore, some solutions avoid transient link failure due to high congestion and time latency, and as a result, the fraction of route failure and packet loss increases. In addition, some solutions have incorporated link evaluation in their routing decision, but they incur the additional cost in terms of energy consumption and computational overheads.  
This article aims to propose a graph-based clustering protocol with trusted routing using a supervised system for WSNs. The EGCIR protocol significantly improves the energy consumption between the sensor nodes and balances the forwarding load on cluster heads. While keeping in mind the limited constraints of low-powered sensors, the EGCIR protocol exploits the intelligent techniques to learn energy-efficient decisions with lower computational power. Furthermore, a trusted mechanism for data transmission with secure key distribution to increase the level of privacy and data integrity is also provided. Normally, keys are the combination of random bits and are used for the aim of data privacy. In the proposed solution, encryption keys are generated and distributed hierarchically to nodes to cope with large network sizes. On trusted routes, this improves the ratio of successful packet delivery and reduces the chances of faulty nodes to disclose the network data. The EGCIR protocol also produces some randomness in the key request and data encryption packets, thus, malicious nodes will not be able to resend the request packet for getting keys and encrypted data. Moreover, it maintains the routing path more intellectually based on an undirected graph model and leads to avoiding link disturbing and data breaches.