# A Community-Based Construct Method for an Inter-Satellite Communication Network of Satellite Swarm
## 3 Community-Based Construct Method of an ICNS
### Algorithm to Sample a CCLC  
A CCLC is a matching of a PLN according to graph theory, since the CCLC is a set of edges in the PLN that are pairwise disjointed. If the cardinality of a CCLC is \(\frac{1}{2}\Theta\), the CCLC is a perfect matching of the PLN. As the enumeration problem for perfect matchings in general graphs is NP-hard [17], it is almost impossible to count the number of all CCLCs. In addition, if there were a large number of satellites, the number of accessible available CCLCs must be astronomical. Consequently, the enumeration of CCLCs is unavailable.  
Therefore, we attempted to collect a sample of all CCLCs. The sample was required to cover all of \(\widetilde{E}_{k}\), which ensured the representativeness of the sample. The sample of all CCLCs that was used to construct \(G_{k}\) is designated by \(\mathcal{M}_{k}=\{M_{k}(\varepsilon)\}\), where \(M_{k}(\varepsilon)\) denotes the \(\varepsilon\)-th CCLC in \(\mathcal{M}_{k}\). \(\mathcal{M}_{k}\) can be obtained by Algorithm 1.  
```
0: Adjacency matrix \(\mathbf{A}_{k}\) of \(\widetilde{\mathcal{G}}_{k}\) Output: A subset of all CCLCs \(\mathcal{M}_{k}\)
1: Establish an empty set of CCLC \(\mathcal{M}_{k}=\{\}\) and \(\varepsilon=1\)
2:for\(i=1\)to\(\Theta\)do
3:for\(j=i+1\)to\(\Theta\)do
4:if\(a_{ij}^{[k]}=1\)and \(\widetilde{\mathcal{E}}_{ij}\
otin E^{\prime}\)then
5: Establish a set of visited nodes \(V^{\prime}=\left\{v_{i},v_{j}\right\}\) and a set of visited edges \(E^{\prime}=\left\{\widetilde{\mathcal{E}}_{ij}\right\}\)
6:for\(y=1\)to\(\Theta\)do
7: Establish a CCLC \(M_{k}(\varepsilon)=\left\{\widetilde{\mathcal{E}}_{ij}\right\}\)
8:for\(\lambda=1\)to\(\Theta\)do
9:for\(\mu=\Theta\)to\(1\)do
10:if\(v_{\lambda},v_{\mu}\
ot\in V^{\prime},\widetilde{\mathcal{E}}_{\lambda\mu} \
otin E^{\prime}\), and \(a_{\lambda\mu}^{[k]}=1\)then
11:\(M_{k}(\varepsilon)\gets M_{k}(\varepsilon)\cup\left\{\widetilde{ \mathcal{E}}_{\lambda\mu}\right\},\;V^{\prime}\gets V^{\prime}\cup\left\{v _{\lambda},v_{\mu}\right\},\;E^{\prime}\gets E^{\prime}\cup\left\{ \widetilde{\mathcal{E}}_{\lambda\mu}\right\}\)
12:break
13:endif
14:endfor
15:endfor
16:if\(M_{k}(\varepsilon)\
otin\mathcal{M}_{k}\)then
17:\(\mathcal{M}_{k}\leftarrow\mathcal{M}_{k}\cup\left\{M_{k}(\varepsilon)\right\},\; \varepsilon\leftarrow\varepsilon+1\)
18:endif
19:endfor
20:endif
21:endfor
22:endfor
```  
**Algorithm 1**Sample algorithm for CCLC.  
Not all CCLCs in \(\mathcal{M}_{k}\) obtained by Algorithm 1 must have \(\theta\) elements, so \(\mathcal{M}_{k}\) needs to be modified. If \(\theta=\frac{1}{2}\Theta\), the CCLCs that are less than \(\frac{1}{2}\Theta\) should be removed from \(\mathcal{M}_{k}\). If \(\theta<\frac{1}{2}\Theta\), the CCLCs whose cardinalities are not equal to \(\theta\) should be removed from \(\mathcal{M}_{k}\); however, the subsets with \(\theta\) elements of the CCLCs whose cardinalities are more than \(\theta\) should be added into \(\mathcal{M}_{k}\). We can apply the Tutte theorem [18] to determine the existence of a perfect matching in a PLN; if a perfect matching exists, \(\theta\) should be \(\frac{1}{2}\Theta\) to maximize the number of ISLs.