An approach to the performance of SPC product codes on the erasure channel

Product codes can be used to correct errors or recover erasures. 
In this work we consider the simplest form of a product code, this is, the single parity check (SPC) product code. 
This code has a minimum distance of four and is thus guaranteed to recover all single, 
double, and triple erasure patterns. 
The code is actually capable of recovering a higher number of erasure patterns. 
We count the number of uncorrectable erasure patterns of size $n \times n $ with $t$ erasures, for $t=8$, $2n-3$, $2n-2$ and $ 2n-1$, 
using the relation between erasure patterns and bipartite graphs.


Introduction
The binary erasure channel (BEC) is one of the simplest non-trivial channel models. It was introduced by Elias [4] as a toy example. In this model, single bits are transmitted and either received correctly or known to be lost. Therefore, information may be lost but is never corrupted. The decoding problem is to find the values of the bits given the locations of the erasures and the non-erased part of the codeword. In this model, each codeword symbol is lost with a fixed independent probability and an [n, k, d]-code can recover up to d − 1 erasures. Given a fixed redundancy, maximum distance separable (MDS) codes (i.e., codes with d − 1 = n − k) provide maximal reliability.
The single parity-check (SPC) code is a very popular MDS error detection code, since it is very easy to implement [7]. One bit is appended to an information sequence of n − 1 bits, such that the resulting codeword has an even number of ones. Two or more SPC codes can be used jointly to obtain an SPC product code. SPC product codes have been proposed for applications such as cell loss recovery in ATM networks [8,11], since they achieve a good performance under various decoding schemes [10]. This code has four as minimum distance and is thus guaranteed to recover all erasure patterns with one, two and three erasures. However, it can be proven that, in some cases, up to 2n−1 erasures can be corrected. In [7], the author derived a tight upper bound of the post-decoding erasure rate of the SPC product code, which helps to identify the correctable and uncorrectable erasure patterns. In [9], the author obtained the number of uncorrectable erasure patterns of size n × n with t erasures, for t = 4, 5, 6 and 7. In this work, we perform a counting method to obtain the number of uncorrectable erasure patterns with 8 erasures following a similar argument as in [9]. We also provide an expression for the number of uncorrectable erasure patterns when t = 2n − 1 and a process to obtain this number when t = 2n − 3 and 2n − 2. This process can be generalized for a fixed t. This work is organized as follows. In Section 2 some preliminaries about coding theory are introduced. In Section 3 we provide the number of uncorrectable erasure patterns with 8 erasures. In Section 4, the connection between erasure patterns and bipartite graphs is established and we provide the number of uncorrectable erasure patterns when t = 2n − 1, 2n − 2 and 2n − 3. Finally, in Section 5 we give some conclusions.

Preliminaries
Let F q be the Galois field of q elements. A linear product code C over F q is formed from two other linear codes C h and C v with parameters [n h , k h , d h ] and [n v , k v , d v ] over F q , respectively. The product code C = C h ⊗ C v has parameters [n h n v , k h k v , d h d v ] over F q (see [10]). Since the minimum distance is d h d v , the product code corrects up to d h d v − 1 erasures over the erasure channel.
The codewords of C have length n h n v and can be seen as arrays with size n h × n v . The columns are codewords of C v and the rows are codewords of C h . If the component encoders are systematic, the structure of the codeword can be seen in Figure 1.
In this work, we consider the product code C = C h ⊗ C v , where C h = C v is a linear binary code with parameters [n, n − 1, 2], which is the SPC code. In this case, the parameters of C are [n 2 , (n − 1) 2 , 4].
Here, C h and C v correct only one erasure, since the minimum distance of the codes is 2. As the minimum distance of C is 4, the code corrects up to three erasures, but we will see in Section 4.2 that the code can correct, in some special cases, up to 2n − 1 erasures.  Now, we are ready to introduce the concept of erasure pattern. Definition 1. Given an SPC product code C with parameters [n 2 , (n − 1) 2 , 4], an erasure pattern of size k × k, with t erasures, where 0 ≤ t ≤ k 2 and 1 ≤ k ≤ n, is an array of size k × k where t of the entries correspond to the position of the erasures.
An erasure pattern of size n × n represents a codeword of size n × n, where we only consider the location of the erasures. Given a codeword with t erasures, the decoder performs iterative row-wise and column-wise decoding to recover the erased bits [2]. When a single bit is erased in a row (column), it can be recovered. If more than one bit is erased in a row (column), it is skipped. Decoding is performed until no further recovery is possible. Example 1. Consider the SPC code with parameters [6,5,2] denoted by C. We can construct the binary product code C = C ⊗ C with parameters [36,25,4]. As the minimum distance is 4, we can only correct up to 3 erasures. Consider the erasure pattern in Figure 2(a). Since every row is a codeword of C, we can correct rows with 1 erasure, that is, erasures in every row but the last one. On the other hand, every column is a codeword of C as well, so we can correct columns with 1 erasure and, then, we can correct completely this erasure pattern.
On the other hand, consider the erasure pattern in Figure 2(b). We can only correct 7 erasures. The erasure subpattern of size 2 × 2 in grey cannot be corrected.

Definition 2.
An erasure pattern is said to be correctable (uncorrectable) if it can (not) be completely corrected.

Remark 1.
If an erasure pattern is uncorrectable, it means that after the iterative row-wise and column-wise decoding algorithm mentioned in Section 2, there are still erasures that can not be recovered. Therefore, in each row and column in error, there must be two or more erasures, otherwise we could correct the column or row with only one erasure. As a consequence, we can say that an uncorrectable erasure pattern always contains a subpattern of size m × p, with m, p ≤ n and two or more erasures in each row and each column.
For a codeword of size n × n, erasure patterns with 3 of fewer erasures are always correctable (see Figures 3(a), 3(b) and 3(c)). On the contrary, we will see in Section 4.2 that erasure patterns with 2n erasures or more are always uncorrectable (see, for example, Figure 3   We would like to count the number of possible correctable and uncorrectable erasure patterns with t erasures, where 4 ≤ t ≤ 2n − 1.

Counting erasure patterns
The next theorem provides the number of uncorrectable erasure patterns of size n × n with t erasures, t = 4, 5, 6, 7. This result can be proven performing an exhaustive counting process. However, these results were already proven in [9], so we do not include a proof. d) For t = 7, T 1 + T 2 + T 3 + T 4 , where Following a similar counting process, we can find the number of uncorrectable erasure patterns of size n × n with t = 8 erasures.
Theorem 2. The number of uncorrectable erasure patterns of size n × n with 8 erasures is Proof. We consider all the possible uncorrectable patterns of size n × n with 8 erasures. To illustrate this proof, examples for all the possible uncorrectable patterns of size 5 × 5 with 8 erasures are given in Figure 4. 1. We start considering patterns with a complete uncorrectable subpattern (none of the erasures can be corrected) of size 4×4 with 8 erasures (see Figure 4(a)). We take four columns and four rows from n, that is, n 2. We consider now patterns with one uncorrectable subpattern of size 3 × 3 with 6 erasures and two additional erasures (see Figure 4(d)). We take three rows and three columns from n and consider the 6 possible ways to locate 6 erasures in these 9 positions: 6 n 3 n 3 . In this case, there are four different ways to locate the two extra erasures. According to the order that appears in Figure 4(d), we obtain the following results: • In the first case, we consider two erasures from the area that does not share a row nor a column with the subpattern. This area contains (n−3) 2 positions, then, we consider (n−3) 2 2 cases.
• In the second case, we consider one erasure in the area that shares a row with the subpattern and the other one in the area that shares a column with the subpattern. Each one of these areas contains 3(n − 3) positions and, then, we have to consider 3(n−3) 1 2 cases. • In the third case, we consider one erasure in the separate area and one in the area that shares a row. For the first erasure we have (n−3) 2 1 positions and for the other one we have 3(n−3) 1 cases. We have to count this case twice (changing row by column).
• In the fourth case, both erasures are in the same area, the one that shares a row with the subpattern. These erasures have to be located in different columns, otherwise, we are considering also subpatterns of size 2 × 2 with 4 erasures, and this case will be considered below. We take two columns from n − 3 and three rows in each case, that is, 3 2 n−3 2 . We have to consider this case twice as well (row by column). As a consequence, S 2 agrees with the value that appears in Theorem 2.
3. Now, we consider patterns with one uncorrectable subpattern of size 2 × 2 and 4 extra erasures. Naively, one would count as However, patterns in Figures 4(b),4(c),4(e) and 4(f) are counted more than once.
• Patterns in Figure 4(b) contain 6 subpatterns of size 2 × 2 with 4 erasures, therefore, these patterns are counted 6 times. In this case we are considering 2 rows and 4 columns from n, that is, n 4 n 2 . We have to consider this case twice (rows by columns). Therefore, S 3 agrees with the value proposed in the theorem and it has to be subtracted 5 times from expression (1).
Therefore, these patterns are counted 3 times. Considering the different areas, the separated one and the two areas that share a row and a column with the subpattern, respectively, we can count these cases in the same way we did for S 2 . It is possible to check that S 4 is correct and it has to be subtracted twice from expression (1). • Patterns in Figure 4(c) contain 5 subpatterns of size 2 × 2 with 4 erasures.
Therefore, these patterns are counted 5 times. In this case we are considering 3 rows and 3 columns from n, that is, n 3 n 3 and we can locate the empty position in 9 different places. Therefore, S 5 is correct and it has to be subtracted 4 times from expression (1).
Therefore, these patterns are counted twice. When we count n 2 2 for the first subpattern of size 2 × 2, we are considering all subpattern of size 2 × 2. Therefore, when we consider the other pattern, we are counting twice each complete pattern. Thus, we have to divide the total number by two.
In the first case, we have to consider 2 rows and 2 columns from n and again 2 rows and 2 columns more from n − 2. That is, n In the second case, we have to consider again n 2 2 cases for the first subpattern. The two erasures that share a row with the subpattern can be located in 2 n−2 2 different positions. Since the columns are fixed, the other two erasures in the separated area can be located in n−2 1 positions. We have to consider this case twice (changing rows by columns). In the third case, we have to consider again n 2 2 cases for the first subpattern. The other subpattern shares one erasure with the new subpattern. We have to consider 2 rows and n − 2 columns for one of the erasures and 2 columns and n − 2 rows for the other erasure. The third erasure of the subpattern is fixed, once we have chosen column and row for the other one. Therefore, we have 4 n−2 1 2 possibilities. For the extra erasure in the separate area, we can locate this erasure in any place but the ones that are already occupied with erasures (7 places) and 2 other places that would create subpatterns of size 2 × 3 or 3 × 2 (considered for S 4 ). Therefore, we have n 2 −9 1 possibilities. Finally, the value of S 6 considered in the theorem is correct and it has to be subtracted once from expression (1).
It is clear that the number of erasure patterns of size n×n with t erasures is n 2 t , which is a polynomial of degree 2t in n. Taking into account the results in Theorems 1 and 2, it is possible to check that the number of uncorrectable erasure patterns with t erasures is a polynomial of degree 2t − 4 in n. Therefore, the probability of finding an uncorrectable erasure pattern of size n × n and t erasures, when t is fixed, is close to zero when n grows.
Unfortunately, when the number of erasures grows, it becomes more difficult to count the number of possible uncorrectable patterns of size n × n. At this point we need to use different tools to count the number of uncorrectable patterns like graph theory.

Graph theory approach
In this section we try to see our problem as a graph theory problem. We begin reminding some preliminaries about graph theory.

4.1.
Preliminaries. In this section we introduce some concepts we need for further results. All these notions can be found in [3,5].
A graph G(V, E) consists of a finite non-empty set of vertices V = {v 1 , v 2 , . . . , v n } and a set of edges E which is a subset of the set of pairs . . , e m }, is defined over F 2 in the following way A walk is a path if the vertices and the edges are all distinct. A walk is a cycle if all the vertices are distinct except the first and the last one.
A graph is said to be connected, if there exists a path that connects every two vertices of the graph. For example, every complete graph is connected. Remember  that a complete graph, denoted by K n , is a graph with n vertices where every vertex is connected by an edge to all others. A tree is an undirected graph in which any two vertices are connected by exactly one simple path. In other words, any connected graph without simple cycles is a tree.
A connected component of an undirected graph is a subgraph in which any two vertices are connected to each other by paths, and which is connected to no additional vertices in the graph. For example, the graph shown in Figure 5 has four connected components.
A graph G(V, E) is a bipartite graph with vertex classes U and W , if V = U ∪ W , U ∩ W = ∅ and each edge joins a vertex in U to a vertex in W . A complete bipartite graph, denoted by K n,m , is a bipartite graph where |U | = n, |W | = m and every vertex in V is connected by an edge to every vertex in W .  Example 3. In Figure 7(a) we have an uncorrectable erasure pattern of size 4 × 4 with 8 erasures. This erasure pattern can be seen as a bipartite graph with 8 nodes and 8 edges (see Figure 7(b)). It is possible to check that there is a cycle of length 4 in the corresponding bipartite graph (see Figure 8(a)).
From now on, when we say a bipartite graph is correctable (uncorrectable), we mean that the erasure pattern it represents is correctable (uncorrectable).
In order to check whether a graph is correctable or not, we go over the graph searching for vertices with one single incident edge (any row or column with one erasure). If we find a vertex with one single incident edge, we eliminate this edge   and go over the rest of the vertices again. We perform this search until each vertex has more than one incident edge or none. If we could eliminate each and every edge, the graph is correctable. On the other hand, if there are still edges that cannot be eliminated, the graph is uncorrectable.
Example 4. Consider again Figure 7. We have an erasure pattern of size 4×4 with 8 erasures and the corresponding bipartite graph with 8 nodes and 8 edges. We start eliminating the edge u 2 w 4 . Then, we can remove edges w 4 u 4 and u 4 w 2 . Finally, the last edge that can be eliminated is w 2 u 1 . After removing these four edges, we obtain a cycle. This cycle represents the erasure subpattern of size 2 × 2 with 4 erasures contained in the general erasure pattern, see Figure 8. As a consequence, the graph (and the erasure pattern) is uncorrectable.
According to the previous process, next theorem establishes the connection between bipartite graphs and uncorrectable erasure patterns. Proof. According to Remark 1, if an erasure pattern of size n × n is uncorrectable, it means that there is a subpattern of size m × p, for m, p ≤ n with two or more erasures in each row and column. This subpattern represents a bipartite graph with m and p vertices in each vertex class, respectively, and with two or more incident edges in each vertex, which is a subgraph of the bipartite graph that represents the complete erasure pattern. Then, assuming that m ≥ p, the number of edges in this subgraph is greater or equal than 2m ≥ m + p. According to [3, Corollary 1.5.3], this subgraph must contain at least one cycle. Therefore, the bipartite graph that represents the complete erasure pattern contains this subgraph and contains, then, at least one cycle as well.
On the other hand, assume the bipartite graph contains a cycle. According to [3, Proposition 1.6.1], a graph is bipartite if and only if it contains no odd cycle. Therefore, the length of the cycle must be 2m, for 2 ≤ m ≤ n. This cycle is a bipartite subgraph with m vertices in each vertex class and two incident edges in each vertex, that represents a subpattern of size m × m with two erasures in each row and column. According to the iterative row-wise and column-wise algorithm mentioned in Section 2, the erasure pattern that contains this subpattern cannot be completely corrected and then, it is an uncorrectable erasure pattern.
Then, as a natural consequence of Theorem 3 we can obtain the following result. For instance, if we check Figure 8, it is possible to see that the cycle of length 4 represents an erasure subpattern of size 2 × 2 with 4 erasures.
According to the previous result, we can highlight the following ideas.
Remark 2. When we have t < 4 edges (erasures) we can always correct this graph (erasure pattern), since it is impossible to find a cycle of length less than 4 in a bipartite graph. On the other hand, when we have t > 2n − 1 edges (erasures) in a bipartite graph with n vertices in each vertex class, it cannot be corrected (according to [3,Corollary 1.5.3] there must be at least one cycle).
This is the reason why we only consider the cases where 4 ≤ t ≤ 2n − 1.

Connected components.
We start this section with the following definition.
Definition 3. Given a connected graph, the cyclotomic number is given by The cyclotomic number indicates whether the graph contains cycles or not (see [5]). If N > 0, it indicates the number of edges that must be eliminated to remove the possible cycles from the graph. From the SPC product codes point of view, the cyclotomic number provides the number of erasures we should remove from the erasure pattern to be correctable.
Example 5. The graph given in Figure 7(b) is a connected graph. The cyclotomic number is 8 − 8 + 1 = 1, so we should remove one edge to obtain a graph without cycles, see Figure 9. If we remove the edge in bold, the graph becomes a tree, with no cycles.
Assume our graph has C connected components, then the cyclotomic number can be generalized in the following way N = |E| − |V | + C.
As a consequence, we can introduce the following result.  Proof. If N = 0, it means that the graph contains no cycles and, therefore, the erasure pattern is correctable. Example 6. Consider the bipartite graph in Figure 5. We have four connected components, then N = 4 − 8 + 4 = 0, so the graph contains no cycles and then, the erasure pattern defined by this graph is correctable.

4.4.
Counting trees. The number of uncorrectable erasure patterns with size n × n and t erasures (4 ≤ t ≤ 2n − 1), equals the number of bipartite graphs with 2n nodes, n nodes in each vertex class, t edges and that contain at least one cycle. Equivalently, the number of correctable erasure patterns with size n × n and t erasures is the same as the number of bipartite graphs with 2n nodes, n nodes in each vertex class, and t edges that only contain trees. These problems are equivalent to count the number of subgraphs, with t edges, of the complete bipartite graph K n,n that contain no cycles (correctable), or that contain at least one cycle (uncorrectable). 4.4.1. 2n − 1 2n − 1 2n − 1 erasures. We start this section with some results whose proofs can be found in [1,6].   Proof. A codeword of size n × n is represented by K n,n . Then, according to Lemma 2, the number of trees with 2n − 1 edges contained in K n,n is n n−1 n n−1 = n 2n−2 . The number of trees with 2n − 1 edges equals the number of correctable erasure patterns of size n × n with 2n − 1 erasures.
As a consequence, we can deduce the following result.
C 1 C 2 1 3 3 1 2 2 2 2 3 1 1 3 Table 1. Possible combination of vertices for K 4,4 and 6 edges for the partition {4, 4} According to Corollary 2, for n = 3, the number of uncorrectable erasure patterns with 5 erasures is 45. This number coincides with the number obtained substituting n = 3 in the given expression for t = 5 in Theorem 1.
For n = 4, the number of uncorrectable erasure patterns with 7 erasures is 7344. This number matches as well with the number obtained substituting n = 4 in the given expression for t = 7 in Theorem 1.

2n − 2
2n − 2 2n − 2 erasures. Now, if we consider erasure patterns with 2n − 2 erasures, the cyclotomic number associated to K n,n is given by For the erasure pattern to be correctable, the cyclotomic number must be N = 0. Therefore, we need to consider C = 2 connected components in the corresponding bipartite graph. We have to consider all the possible partitions {m, 2n − m} of the 2n vertices of K n,n , where 1 ≤ m ≤ n, over the two connected components, C 1 and C 2 , taking into account that at least one vertex must appear in each partition. Let us see an illustrative example of this idea.  Table 1, we can see the possible combination of vertices for C 1 and C 2 , in this case. In Figure 10 it is possible to check the corresponding subgraphs for each case considered in Table 1.
Consider again the partition {m, 2n − m} of the 2n vertices of K n,n , where 1 ≤ m ≤ n. We consider that C 1 contains m vertices and C 2 contains 2n − m vertices. Since both connected components are bipartite subgraphs as well, we assume that C 1 contains x 11 and x 12 vertices in each one of its vertex classes and that C 2 contains x 21 and x 22 vertices in each one of its vertex classes, respectively.
Since each vertex class contains n vertices, we have that:   Table 2. Possible partitions over the connected components for K 4,4 and 6 erasures The solution of the system is (3) Let us consider the following example to clarify the idea.
Example 8. Consider again the complete bipartite graph K 4,4 . If we want to count the possible correctable subgraphs with 6 edges, we have to consider two connected components. We know that 1 ≤ m ≤ 4 and for any value of m, we have to consider several values of λ. In Table 2, it is possible to see every combination of m and λ with the corresponding vertices for each connected component C 1 and  otherwise, and Proof. For m = 1, the connected component C 1 has m − n + λ and n − λ vertices in each vertex class. Then, we have to choose m − n + λ vertices from n, that is, n m−n+λ , and n − λ from n, n n−λ . Therefore, we have to consider n m−n+λ n n−λ cases. Furthermore, it has m − 1 edges, so according to Lemma 2, there are (m − n − λ) n−λ−1 (n − λ) m−n+λ−1 possibilities of locating these edges in order for this subgraph to be a tree.
At the same time, C 2 has the remaining 2n − m − λ and λ vertices in each vertex class and 2n − m − 1 edges. According to Lemma 2, there are (2n − m − λ) λ−1 λ 2n−m−λ−1 possibilities of locating these edges in order for this subgraph to be a tree.
When n = m, the variables in expression (3) are given by, This means that our graph has two connected components with {λ, n − λ} vertices in each vertex class, respectively. When have to consider the possible combination of vertices, we take λ vertices from n and n − λ from n, that is, n λ n n−λ . Since both connected components are equal, when we consider n λ n n−λ possibilities, we are counting the connected components twice. That is why we divide f (m, λ) by 2.
On the other hand, when m = 1, there are two possibilities, λ = n or λ = n − 1. For λ = n − 1, the variables in expression (3) are given by, In this case, we have to consider n nodes from n in one vertex class and n − 1 from n in the other vertex class. Furthermore, according to Lemma 2, we have n n n n−1 n n−2 (n − 1) n−1 possibilities. On the other hand, for λ = 1 we have that   Table 4. Different values of m, λ and g(m, λ) for n = 5 In this case we have the same number of possibilities. Therefore, when m = 1 we have in total 2n n−1 (n − 1) n−1 cases to consider.
Example 9. For n = 4, we can check the values of g(m, λ) in Table 3. The number of correctable erasure patterns of size 4 × 4 with 6 erasures is 5632. If we substitute n = 4 in Theorem 1, we obtain that the number of uncorrectable erasure patterns of size n × n with 6 erasures is 2376. The total number of erasure patterns of size 4 × 4 with 6 erasures is given by 16 6 , which agrees with the sum of both numbers. For n = 5, the number of correctable erasure patterns of size 5×5 with 8 erasures is 515625 (see computations in Table 4). If we substitute n = 5 in Theorem 1, we obtain that the number of uncorrectable erasure patterns of size 5×5 with 8 erasures is 565950. The total number of erasure patterns of size 5 × 5 with 8 erasures is 25 8 , which agrees with the sum of both numbers.

2n − 3
2n − 3 2n − 3 erasures. Now, we consider erasure patterns of size n × n and 2n − 3 erasures. In this case, we have to consider subgraphs of K n,n with 2n − 3 edges and 2n edges. For the erasure pattern to be correctable, the cyclotomic number must be N = 0. Therefore, we need to consider C = 3 connected components in the corresponding bipartite graph. We have to consider all the possible partitions for the vertices over three connected components, and at least one vertex must appear in each partition.
Following the same ideas considered in Section 4.4.2, we can introduce the following result.  Table 5. The number of correctable erasure patterns of size 4 × 4 with 5 erasures is 3936. If we substitute n = 4 in Theorem 1, we obtain that the number of uncorrectable erasure patterns of size n × n with 5 erasures is 432. The total number of erasure patterns of size 4 × 4 with 5 erasures is given by 16 5 , which agrees with the sum of both numbers.

Conclusions
A study of the erasure patterns in SPC product codes has been developed. This approach finds the uncorrectable erasure patterns for a given number of erasures using a counting method and the connection between bipartite graphs and erasure patterns.