## 5 Design of Greedy Grouping Algorithm  
Without loss of generality, this paper considers the case of a multi-channel multi-interface WSN with a single gateway. The network topology is layered, based on the hops between each sink node and the gateway. Each level of sinks is associated with a group of sensors that continuously monitor mining status and periodically collect data in the smart healthcare environment. It is assumed that \(L_{i}\) and \(U_{i}\) respectively denote the \(i\)th level of the sink and sensor sets. Sink nodes normally converse over two orthogonal radio channels. One channel communicates between the sinks to construct the underlying infrastructure, while the other is responsible for communications between the sinks and sensors. This ensures sinks and sensors work simultaneously without mutual interference. The levels of sink nodes occupy the wireless channel using Time Division Multiple Address (TDMA). Each layer of sink nodes is allocated a special time slot for packet transmission. This means that data transmission in each level occurs at the same time. Within each time slot, sensors first deliver data to the relevant level of sinks; the sinks then begin to re-transmit the corresponding data. Typically, each set of sensors and its associated level of sinks is active only during specific time slots assigned to it. The \(n\) source nodes represent sensor nodes in the active layer in our network model. If each sensor generates a separate data unit, there will be a total of \(n\) data units (from source nodes) that need to be forwarded to the gateway. Here, the binary linear network coding technique is employed to effectively prevent a link failure phenomenon. In our proposal, the minimum number of paths is adopted to provide as much fault-tolerance as possible. If network latency \(t\) is taken into account, the output packet combination can be formulated as in Formula (1):  
\[Y_{j}(t+1)=\sum_{i=1}^{L}g_{ij}X_{i}(t)+\sum f_{j}Y(j)(t) \tag{1}\]  
In the network model, it is assumed that sensor nodes collect status information periodically. The sink nodes preserve sufficient storage space to accommodate native packets, to encode these original packets and to transmit them. For simplicity, we ignore the delay caused by the encoding operation in our network model. Therefore, here we can calculate the simplified representation of output packets in Formula (2) as follows:  
\[Y_{j}=\sum_{i=1}^{L}g_{ij}X_{i} \tag{2}\]  
For random linear network coding, in Formulas (1) and (2), \(X_{i}\) and \(Y_{j}\) represent the input and output packets, where \(i\) and \(j\) denote the incoming and output links, respectively. In particular, we use \(g_{ij}\) to represent the coding vector generated randomly, \(L\) to represent the number of incoming packets, and \(Y(j)\) to represent the native packets generated by the sink nodes themselves. Due to the harsh wireless communication environment in smart healthcare, packet corruption occurs often. Based on the principle of random linear network coding, coded packets are mathematically random linear combinations of the native packets. Based on the GE theory, destination nodes can recover corrupted packets with higher probability. Note that the encoding vector \(g_{ij}\) must be recorded in the packet header to assist the destination nodes in the decoding process. Because of the broadcast nature of wireless media, sink nodes can overhear the encoding combinations generated by neighbours. They can then encode them together and forward them. In random linear network coding for our proposal, the coding node encodes the incoming packets with the global encoding vector embedded in the header. The extra fields (or bytes) in messages, as well as storage overhead for coding functions, can also incur a few expenses, compared with traditional methods. Here, note the coding conditions in our proposal target WSNs with omni-directional antenna, in which the sensor and sink nodes are resource-constrained.