# Improved PEG-Based Construction of Analog Fountain Codes
## 3 Improved PEG-Based Construction
### Improved PEG-Based Construction Method  
It is well known that short cycles may deteriorate the performance of the BP decoding. Large weight coefficients should not be involved in harmful short cycles due to their high contribution in the BP decoding. AFC construction involves two steps: edge selection and weight coefficient allocation. From these two aspects, we propose to construct generator matrix as follows.  
During edge selection, we balance the weight of columns in \(\mathbf{G}\) with a reliability measure denoted by \(\sum_{p=0}^{i-1}g_{p,q}^{2}\). The reliability measure represents the sum of squares of weight coefficients for the \(q\)-th column of \(\mathbf{G}\) before the edges for \(c_{i}\) are established. Apparently, if a column has a relatively low reliability measure, a corresponding edge should be selected to enlarge its reliability measure. Thus, each time the PEG establishes a candidate set of VN for edge selection, the set is further downsized based on the smallest reliability measure set \(Q=\{q|\arg\min_{q}\sum_{p=0}^{i-1}g_{p,q}^{2}\}\).  
With regard to weight coefficient allocation, recall that the PEG maximizes the cycle length, which means that the edges selected earlier are more likely to be in large cycle. In other words, the edges selected later are more likely to be in the short cycle. Thus, they should not be allocated with larger weight coefficients. It forms the weight coefficient allocation strategy that allocating larger weight coefficients to earlier selected edges.  
The proposed construction is presented as follows and the details are summarized in Algorithm 1. Given the parameters \(k\), \(n\), \(d\), and \(\mathrm{W}\), an edge-selection procedure is initiated. Let \(E_{c_{i}}^{j}\) denote the \(j\)-th edge selected for \(c_{i}\), where \(0\leq j<d\). The placement of a new edge \(E_{c_{i}}^{0}\) on the graph considers the reliability measure of each column. Specifically,  
Figure 2: EXIT charts of different weight coefficients, where \(d=4\), \(W_{s}=\{1/2,1/3,1/5,1/7\}\), and signal–noise ratio \((\mathrm{SNR})=18\) dB.  
\(E_{c_{i}}^{0}\leftarrow\text{edge}(c_{i},b_{q})\), where \(q\) is randomly selected from \(Q=\{q|\arg\min_{q}\sum_{p=0}^{i-1}g_{p,q}^{2}\}\). Subsequently, the largest weight coefficient \(w_{0}\) is allocated to \(E_{c_{i}}^{0}\) as \(g_{i,q}=w_{0}\).  
After that, the subgraph from \(c_{i}\) is expanded using the strategy of PEG [13], ending up with the set \(\overline{N_{c_{i}}^{l}}\). When the expanded stage is finished, \(E_{c_{i}}^{l}\leftarrow\text{edge}(c_{i},b_{q})\), where \(q\) is randomly selected from a refreshed \(Q=\{q|\arg\min_{q}\sum_{p=0}^{i-1}g_{p,q}^{2},b_{q}\in\overline{N_{c_{i}}^{l}}\}\). Then, the next weight coefficient \(w_{j}\) is allocated to \(E_{c_{i}}^{j}\) as \(g_{i,q}=w_{j}\). This step is repeated until \(d\) edges are selected, and then the process moves to the next CN.  
```
0:\(k\), \(n\), \(d\), \(\text{W}\)
0: AFC generator matrix \(\mathbf{G}\)
1:\(\mathbf{G}=zeros(n,k)\)
2:for\(i=0\) to \(n-1\)do
3:for\(j=0\) to \(d-1\)do
4:if\(j=0\)then
5:\(Q=\{q|\arg\min_{q}\sum_{p=0}^{i-1}g_{p,q}^{2}\}\)
6:\(E_{c_{i}}^{0}\leftarrow\text{edge}(c_{i},b_{q})\), where \(q\) is randomly selected from \(Q\).
7: Update the \(g_{i,q}=w_{0}\).
8:else
9: expand a subgraph from \(c_{i}\) up to depth \(l\) under the current graph setting such that the cardinality \(N_{c_{i}}^{l}\) stops increasing but \(\left|N_{c_{i}}^{l}\right|<k\), or \(\overline{N_{c_{i}}^{l}}\
eq\emptyset\) but \(\overline{N_{c_{i}}^{l+1}}=\emptyset\).
10:\(Q=\{q|\arg\min_{q}\sum_{p=0}^{i-1}g_{p,q}^{2},b_{q}\in\overline{N_{c_{i}}^{l}}\}\)
11:\(E_{c_{i}}^{l}\leftarrow\text{edge}(c_{i},b_{q})\), where \(q\) is randomly selected from \(Q\).
12: Update the \(g_{i,q}=w_{j}\).
13:endif
14:endfor
15:endfor
16:Return \(\mathbf{G}\).
```  
**Algorithm 1** Improved PEG-based construction algorithm.