# Clustering-Based Channel Allocation Method for Mitigating Inter-WBAN Interference
## 4 Cluster-Based Channel Allocation Method
### Adaptive Module  
The WBANs in \(\mathcal{S}\) may change their locations according to their mobility characteristics during a time slot. In addition, new WBANs may enter into \(\mathcal{S}\), and some WBANs may move out of the area. The base module may be invoked at every time slot to resolve the issue. However, since the time complexity of a graph partitioning algorithm increases with the number of edges in the graph, the base module may not be fast enough for allocating channels in a dynamic environment where WBANs move around. To address the issue, we design the adaptive module to enable a channel allocation process to adjust to the gradual changes of the interference relationship graph fast. The adaptive module is invoked at the beginning of each time slot \(t\). It uses not only \(N(t)\) and \(\vec{p}(v)\)s (\(\forall v\in N(t)\)) but also the cluster information of the previous time slot \(C(t-1)=\{C_{1}(t-1),\cdots,C_{|\mathcal{C}(t-1)|}(t-1)\}\) and \(\vec{p}(C_{i}(t-1))\)s (\(\forall C_{i}(t-1)\in C(t-1)\)). If a WBAN \(v_{new}\) newly moves into the region \(\mathcal{S}\) during the previous time slot \(t-1\), it does not belong to any cluster in \(C(t-1)\). The adaptive module determines the cluster that \(v_{new}\) belongs to by using the distance between \(v_{new}\) and \(\vec{p}(C_{i}(t-1))\), \(\forall C_{i}(t-1)\in C(t-1)\). Specifically, \(v_{new}\) becomes the member of the closest cluster \(C_{x}(t-1)\), where  
\[C_{x}(t-1)=\text{argmin}_{C_{i}(t-1)\in C(t-1)}||\vec{p}(v_{new})-\vec{p}(C_{i} (t-1))||_{2}. \tag{8}\]  
If a WBAN \(v_{i,j}\in C_{i}(t-1)\) moves during the time slot, it may be closer to the centroid of the other cluster than \(\vec{p}(C_{i}(t-1))\). In this case, the adaptive module changes the cluster membership of the WBAN \(v_{i,j}\) from \(C_{i}(t-1)\) to the cluster \(C_{y}(t-1)\) whose centroid is the closest to the current location of the WBAN \(v_{i,j}\). After determining the cluster membership of all the WBANs in \(N(t)\), the adaptive module obtains the updated cluster information \(C^{\prime}(t)=\{C^{\prime}_{1}(t),\cdots,C^{\prime}_{|\mathcal{C}(t-1)|}(t)\}\) at the start of the \(t\)-th time slot. Then, the adaptive module calculates the modularity of \(C^{\prime}(t)\) to inspect the quality of the fast adaptation. If the modularity of \(C^{\prime}(t)\) is larger than a threshold value \(\delta_{m}\), the adaptive module regards the situation as the graph structure is not changed abruptly. Therefore, the adaptive module adjusts quickly to the gradual change by reassigning only the channels of a subset of WBANs. Specifically, for each cluster \(C^{\prime}_{i}(t)\in C^{\prime}(t)\), a cloud server compares the members in \(C_{i}(t-1)\) and those in \(C^{\prime}_{i}(t)\). If \(C_{i}(t-1)\) is identical to \(C^{\prime}_{i}(t)\) or \(C^{\prime}_{i}(t)\subset C_{i}(t-1)\), each WBAN in \(C^{\prime}_{i}(t)\) uses the same channel that it used in the previous time slot. However, when the cluster members are changed during a time slot (i.e., \(C_{i}(t-1)\
eq C^{\prime}_{i}(t)\) and \(C^{\prime}_{i}(t)\) is not a subset of \(C_{i}(t-1)\)), the adaptive module allocates channels to the WBANs in \(C^{\prime}_{i}(t)\) by applying the same channel allocation procedure in Algorithm 1 (from line 7 to line 17). After determining the channels for all the WBANs in \(C^{\prime}_{i}(t)\), the adaptive module updates the center point of the cluster \(C^{\prime}_{i}(t)\). On the other hand, if the modularity is less than a threshold value \(\delta_{m}\), the adaptive module regards that the topology of an interference relationship graph changed a lot during a time slot. Thus, the adaptive module determines that the total interference in the system needs to be improved by partitioning the current graph again.