## 2 Materials and Methods
### MK-Mediod Algorithm  
K-Means algorithm is the most classical division-based clustering method. The basic idea of K-Means algorithm is to cluster k points in the space as the center of mass and group the objects closest to them. By an iterative method, the value of each cluster center of mass is updated round by round until the best clustering result is obtained. However, the clustering result of the K-Means algorithm is easily affected by noise and isolated points. K-Mediod and K-Means algorithm are similar in basic idea, the biggest difference is that when updating the clustering center, K-Mediod calculates the minimum value of the distance from each point to all other points in the cluster except for the cluster center to optimize the new cluster center. It is this difference that makes up for the shortcomings of the K-Means algorithm.  
For clustering child nodes, the original K-Mediod algorithm does not suit well in the following aspects: (i) the initial cluster center selection in the K-Mediod algorithm is random, thus it is easy to fall into a local optimum; (ii) the criterion of the cluster center selection in the K-Mediod algorithm is the minimum distance to all other points, but index neighbors should obey constraints in Equation (6), involving not only the distance from the cluster center to other nodes in the cluster, but also the distance from the cluster center to the master node.  
Based on the two points above, this paper makes the following improvements to the K-Mediod algorithm: (i) firstly, the child nodes are sorted according to their latency to the master node, and child nodes that are closest to the master node are selected as the initial cluster centers; (ii) during the cluster centers updating procedure, the sum of minimum latency from the center to other nodes and latency from the center to master node is used as the selection criteria.  
Index Neighbor Structure Construction Based on MK-Mediod Algorithm  
The above MK-Mediod algorithm can cluster the child nodes into a given number of groups, and the clustering results can be validated as candidate index neighbor groups. The validation depends on whether the cluster center meets latency constraints in Equation (6). That is, the sum of the maximum latency from the cluster center to other nodes in the group and latency from the cluster center to the master node is within a certain latency constraint.  
The main idea of our index neighbor construction algorithm proposed in this paper is to validate candidate groups in a greedy manner: firstly, we set group number to 1, cluster the child nodes into 1 cluster, and validate whether a node can be found in this group as an index neighbor node of the master node, which satisfies the latency constraint in Equation (6); if the validation is successful, then the construction procedure is over, and the index neighbor and corresponding index neighbor group are found. If it fails, then the group number is increased to 2, the child nodes are clustered into 2 clusters, and whether there could be an index neighbor node in each group is validated. If the validation succeeds, then the construction procedure is over, and the index neighbors and corresponding index neighbor groups are found. If it fails, then we increase the group number to 3, and repeat the same procedure until a final result is found. The algorithm pseudo code is shown in Algorithm 2.