# Minimum Interference Channel Assignment Algorithm for Multicast in a Wireless Mesh Network
## 3 Minimum Interference Channel Assignment
### Assigning a Channel Number to All Nodes  
In the final round, MICA needs to assign a channel number to all of the nodes in \(S_{N}\). The final process is well illustrated in Algorithm 3. ```
1:input: \(T\), a multicast tree
2:\(S_{D}\), the set of nodes with a channel number for their sending interface
3:\(S_{N}\), the set of nodes without a channel number for their sending interface
4:output:Channel assignment for all network interfaces
5:CS\(<\)u, v\(>\): the channel separation of all pairs of nodes in \(T\)
6:CH\({}_{i}\): a channel number for node \(i\)
7:COND\({}_{i}\): the set of conditions for deciding a channel number of node \(j\)
8:procedureASSIGNING A CHANNEL NUMBER
9:while\(S_{N}\
eq\varnothing\)do
10: find \(x\in S_{N}\), \(y\in S_{D}\) such that \(CS\)\(<\)\(x\), \(y\)\(>\) is a maximum
11:for each node \(k\in S_{D}\)do
12:\(COND_{x}\leftarrow\) [\(CH_{x}\)\(>=CH_{k}\)\(+\)\(CS\)\(<\)\(x\), \(k\)\(>\) or \(CH_{x}\)\(<=CH_{k}\)\(-\)\(CS\)\(<\)\(x\), \(k\)\(>\)]
13: eliminate all invalid channel numbers
14:\(\widehat{COND}_{x}\leftarrow\)\(COND_{x}\)\(-\) conflict conditions
15: select \(CH_{x}\) that satisfies all conditions \(\in\)\(\widehat{COND}_{x}\)
16:end
```  
**Algorithm 3**Assigning a Channel Number to All Nodes  
MICA takes \(S_{D}\) and \(S_{N}\) as inputs and produces a final channel assignment for all network interfaces of every node in a multicast tree. First, MICA compares a channel separation of each node \(i\) in \(S_{N}\) with all nodes in \(S_{D}\). After finishing all comparisons, it selects one node which has a channel separation of a maximum value. Next, for each node \(k\) in \(S_{D}\), it can be possible for MICA to generate several conditions for the channel number of node \(i\). One possible channel number of \(i\) might be greater than, or equal to, the summation of \(CS\)\(<\)\(k\), \(i\)\(>\) and the channel number of \(k\). The other could be less than, or equal to, the difference between \(CS\)\(<\)\(k\), \(i\)\(>\) and the channel number of \(k\). Based on the number of elements of \(S_{D}\), the number of conditions will be decided. After producing all possible conditions, MICA can choose a channel number for node \(i\). Eventually, the selected channel number will be used for the sending interface of \(i\). Now MICA can remove \(i\) from \(S_{N}\) and put it into \(S_{D}\). This process keeps running until there are no elements in \(S_{N}\), which means the sending interface of all nodes in a multicast tree has its own channel number. Lastly, we can easily assign a channel number to each receiving interface of all nodes because the receiving interface of each node should be the same channel number as its parent's sending interface to communicate with each other. The algorithm of assigning channel numbers is affected by the algorithm shown in Algorithm 2. Therefore, this channel assignment algorithm takes \((n)\) in the worst case. As a result, the overall time complexity of the proposed channel assignment algorithm takes \((n)\), where \(n\) is the total number of nodes in the network. The following scenario is a specific example in order to demonstrate the final step. Let us assume that \(S_{D}=\{\)A, H\(\}\), \(S_{N}=\{\)S, B, C, D, E\(\}\), nodes A and D have a channel separation of 3, and H and D have a channel separation of 2. One more assumption is that \(CS<\)A, D\(>\) is the maximum channel separation among all nodes in \(S_{N}\). Therefore, node D can have its own channel number based on this maximum value. Suppose that the channel number of \(A\) is 6 and the channel difference between A and D is 3, there might be one of the following conditions: the channel number of D is less than or equal to 3 (\(COND_{1}\)) or that of D is greater than or equal to 9 (\(COND_{2}\)). Therefore, D can have the channel number 3 or 9. In addition, assume that H uses the channel number of 11 and the channel separation between H and D is 2.