Expander codes
In coding theory, an expander code is a [ n , n − m ] 2 linear block code whose parity check matrix is the adjacency matrix of a bipartite expander graph. These codes have good relative distance 2 ( 1 − ε ) γ , where ε and γ are properties of the expander graph as defined later), rate ( 1 − m n ) , and decodability (algorithms of running time O ( n ) exist).
Consider a bipartite graph G ( L , R , E ) , where L and R are the vertex sets and E is the set of edges connecting vertices in L to vertices of R . Suppose every vertex in L has degree d (the graph is d -regular), | L | = n , and | R | = m , m < n . Then G is a ( N , M , d , γ , α ) expander graph if every small enough subset S ⊂ L , | S | ≤ γ n has the property that S has at least d α | S | distinct neighbors in R . Note that this holds trivially for γ ≤ 1 n . When 1 n < γ ≤ 1 and α = 1 − ε for a constant ε , we say that G is a lossless expander.
Since G is a bipartite graph, we may consider its n × m adjacency matrix. Then the linear code C generated by viewing the transpose of this matrix as a parity check matrix is an expander code.
It has been shown that nontrivial lossless expander graphs exist. Moreover, we can explicitly construct them.
The rate of C is its dimension divided by its block length. In this case, the parity check matrix has size m × n , and hence C has dimension at least ( n − m ) / n = 1 − m n .
Suppose ε < 1 2 . Then the distance of a ( n , m , d , γ , 1 − ε ) expander code C is at least 2 ( 1 − ε ) γ n .
Note that we can consider every codeword c in C as a subset of vertices S ⊂ L , by saying that vertex v i ∈ S if and only if the i th index of the codeword is a 1. Then c is a codeword iff every vertex v ∈ R is adjacent to an even number of vertices in S . (In order to be a codeword, c P = 0 , where P is the parity check matrix. Then, each vertex in R corresponds to each column of P . Matrix multiplication over GF ( 2 ) = { 0 , 1 } then gives the desired result.) So, if a vertex v ∈ R is adjacent to a single vertex in S , we know immediately that c is not a codeword. Let N ( S ) denote the neighbors in R of S , and U ( S ) denote those neighbors of S which are unique, i.e., adjacent to a single vertex of S .
For every S ⊂ L of size | S | ≤ γ n , d | S | ≥ | N ( S ) | ≥ | U ( S ) | ≥ d ( 1 − 2 ε ) | S | .
Trivially, | N ( S ) | ≥ | U ( S ) | , since v ∈ U ( S ) implies v ∈ N ( S ) . | N ( S ) | ≤ d | S | follows since the degree of every vertex in S is d . By the expansion property of the graph, there must be a set of d ( 1 − ε ) | S | edges which go to distinct vertices. The remaining d ε | S | edges make at most d ε | S | neighbors not unique, so U ( S ) ≥ d ( 1 − ε ) | S | − d ε | S | = d ( 1 − 2 ε ) | S | .
Every sufficiently small S has a unique neighbor. This follows since ε < 1 2 .
Every subset T ⊂ L with | T | < 2 ( 1 − ε ) γ n has a unique neighbor.
Lemma 1 proves the case | T | ≤ γ n , so suppose 2 ( 1 − ε ) γ n > | T | > γ n . Let S ⊂ T such that | S | = γ n . By Lemma 1, we know that | U ( S ) | ≥ d ( 1 − 2 ε ) | S | . Then a vertex v ∈ U ( S ) is in U ( T ) iff v ∉ N ( T ∖ S ) , and we know that | T ∖ S | ≤ 2 ( 1 − ε ) γ n − γ n = ( 1 − 2 ε ) γ n , so by the first part of Lemma 1, we know | N ( T ∖ S ) | ≤ d ( 1 − 2 ε ) γ n . Since ε < 1 2 , | U ( T ) | ≥ | U ( S ) ∖ N ( T ∖ S ) | ≥ | U ( S ) | − | N ( T ∖ S ) | > 0 , and hence U ( T ) is not empty.
Note that if a T ⊂ L has at least 1 unique neighbor, i.e. | U ( T ) | > 0 , then the corresponding word c corresponding to T cannot be a codeword, as it will not multiply to the all zeros vector by the parity check matrix. By the previous argument, c ∈ C ⟹ w t ( c ) ≥ 2 ( 1 − ε ) γ n . Since C is linear, we conclude that C has distance at least 2 ( 1 − ε ) γ n .
The encoding time for an expander code is upper bounded by that of a general linear code - O ( n 2 ) by matrix multiplication. A result due to Spielman shows that encoding is possible in O ( n ) time.
Decoding of expander codes is possible in O ( n ) time when ε < 1 4 using the following algorithm.
Let v i be the vertex of L that corresponds to the i th index in the codewords of C . Let y ∈ { 0 , 1 } n be a received word, and V ( y ) = { v i | the i th position of y is a 1 } . Let e ( i ) be | { v ∈ R | N ( v ) ∩ V ( y ) is even } | , and o ( i ) be | { v ∈ R | N ( v ) ∩ V ( y ) is odd } | . Then consider the greedy algorithm:
Input: received codeword y .
initialize y' to ywhile there is a v in R adjacent to an odd number of vertices in V(y') if there is an i such that o(i) > e(i) flip entry i in y' else failOutput: fail, or modified codeword y ′ .
We show first the correctness of the algorithm, and then examine its running time.
We must show that the algorithm terminates with the correct codeword when the received codeword is within half the code's distance of the original codeword. Let the set of corrupt variables be S , s = | S | , and the set of unsatisfied (adjacent to an odd number of vertices) vertices in R be c . The following lemma will prove useful.
Lemma 3
If 0 < s < γ n , then there is a v i with o ( i ) > e ( i ) .
Proof
By Lemma 1, we know that U ( S ) ≥ d ( 1 − 2 ε ) s . So an average vertex has at least d ( 1 − 2 ε ) > d / 2 unique neighbors (recall unique neighbors are unsatisfied and hence contribute to o ( i ) ), since ε < 1 4 , and thus there is a vertex v i with o ( i ) > e ( i ) .
So, if we have not yet reached a codeword, then there will always be some vertex to flip. Next, we show that the number of errors can never increase beyond γ n .
Lemma 4
If we start with s < γ ( 1 − 2 ε ) n , then we never reach s = γ n at any point in the algorithm.
Proof
When we flip a vertex v i , o ( i ) and e ( i ) are interchanged, and since we had o ( i ) > e ( i ) , this means the number of unsatisfied vertices on the right decreases by at least one after each flip. Since s < γ ( 1 − 2 ε ) n , the initial number of unsatisfied vertices is at most d γ ( 1 − 2 ε ) n , by the graph's d -regularity. If we reached a string with γ n errors, then by Lemma 1, there would be at least d γ ( 1 − 2 ε ) n unique neighbors, which means there would be at least d γ ( 1 − 2 ε ) n unsatisfied vertices, a contradiction.
Lemmas 3 and 4 show us that if we start with s < γ ( 1 − 2 ε ) n (half the distance of C ), then we will always find a vertex v i to flip. Each flip reduces the number of unsatisfied vertices in R by at least 1, and hence the algorithm terminates in at most m steps, and it terminates at some codeword, by Lemma 3. (Were it not at a codeword, there would be some vertex to flip). Lemma 4 shows us that we can never be farther than γ n away from the correct codeword. Since the code has distance 2 ( 1 − ε ) γ n > γ n (since ε < 1 2 ), the codeword it terminates on must be the correct codeword, since the number of bit flips is less than half the distance (so we couldn't have traveled far enough to reach any other codeword).
We now show that the algorithm can achieve linear time decoding. Let n m be constant, and r be the maximum degree of any vertex in R . Note that r is also constant for known constructions.
- Pre-processing: It takes O ( m r ) time to compute whether each vertex in R has an odd or even number of neighbors.
- Pre-processing 2: We take O ( d n ) = O ( d m r ) time to compute a list of vertices v i in L which have o ( i ) > e ( i ) .
- Each Iteration: We simply remove the first list element. To update the list of odd / even vertices in R , we need only update O ( d ) entries, inserting / removing as necessary. We then update O ( d r ) entries in the list of vertices in L with more odd than even neighbors, inserting / removing as necessary. Thus each iteration takes O ( d r ) time.
- As argued above, the total number of iterations is at most m .
This gives a total runtime of O ( m d r ) = O ( n ) time, where d and r are constants.