On the number of minimal codewords in codes generated by the adjacency matrix of a graph

Minimal codewords have applications in decoding linear codes and in cryptography. We study the number of minimal codewords in binary linear codes that arise by appending a unit matrix to the adjacency matrix of a graph.


Introduction
Given a linear code its minimal codewords are those whose supports, i.e., the set of nonzero coordinates, do not properly contain the support of another nonzero codeword.They have applications e.g. in secret sharing schemes [9,13], two-party computation [10], and decoding algorithms [2,12].Complete decoding is an NP-hard problem [7], so that it is no surprise that determining the set of minimal codewords is also a hard problem.Their number can grow exponentially in the dimension or the length of the code.The cases where all codewords are minimal are called minimal codes (or intersecting codes in the binary situation).They have e.g.applications in combinatorics [16].Indeed, the set of minimal codewords is only known for a few classes of linear codes, including q-ary Hamming codes, see e.g.[6,1].For Reed-Muller codes the problem is only partially solved, see e.g.[8,15] and the references cited therein.
Here we consider the concatenation of a unit matrix and the adjacency matrix of a graph as a generator matrix of a linear code and study the sets of minimal codewords.For some graph classes we can characterize the sets of minimal codewords and count them.We can fully solve the problem for complete multipartite graphs, paths, and cycles.We also state some lower and upper bounds for the number of minimal codewords in terms of graph parameters.For small numbers of vertices we determine the maximum and minimum number of minimal codewords of connected graphs.It turns out that the minimum number of minimal codewords is always attained by paths.In [3] graphs where associated to linear codes via their cycle space and the corresponding sets of minimal codewords are studied.

Preliminaries
An [n, k] q linear code C is a k-dimensional subspace of F n q .Given a vector x ∈ F n q , the support of x is defined as supp(x) = {i : x i = 0, 1 ≤ i ≤ n}.A k × n matrix G whose rows form a basis for C is called a generator matrix.If G = [I k |A], where I k is the k × k identity matrix, then it is said to be systematic or in standard form.A nonzero codeword c ∈ C is minimal if there does not exist a nonzero codeword c ′ such that supp(c ′ ) supp(c).Otherwise (including the case c = 0), we call the codeword c non-minimal.Note that a codeword and its nonzero scalar multiples have the same support.We say that two codewords are equivalent if one is a scalar multiple of the other.We use the notation M (C) for the number of non-equivalent minimal codewords of C. In the following we will mainly consider binary codes.For some known properties of minimal codewords we refer the interested reader e.g. to [6] and the references cited therein.
Given a graph G = (V, E) with vertex set V and edge set E, we denote by C(G) the binary linear code that is generated by [I #V |A], where A is an adjacency matrix of G.As a shorthand we use the notation M (G) for M (C(G)).Note that M (G) does not depend on the labeling of the vertices.In the remaining part of the paper we will give brief definitions for most of the used notions from graph theory.For standard definitions like e.g. a connected graph or its connectivity components we refer the reader to some standard text book on graph theory like e.g.[17].
First we observe that we can restrict ourselves to the study of M (G) for connected graphs: Proof.The statement is obvious from the direct sum This trivial lower bound is attained with equality for graphs without edges, i.e., M ((V, ∅)) = #V .
In order to obtain a more interesting problem, we define m(n) as the minimum of M (G), where G is a connected graph with n vertices, i.e., we ask for the minimum number of minimal codewords a graph with n vertices can give.Similarly, let M (n) denote the maximum of M (G), where G is a graph, not necessarily connected, with n vertices.
More generally, let M q (n, k) be the maximum and m q (n, k) the minimum of M (C) for all [n, k] q codes C. Bounds and some exact values on M q (n, k) and m q (n, k) can be found in [2,4,5,6,11].Obviously, we have Let C be a linear [k + t, k] 2 code with systematic generator matrix G.By g i we denote the ith row of G, where 1 ≤ i ≤ k.For each subset S ⊆ {1, . . ., k} let c S denote the sum of the rows of G with indices in S, i.e., c S = i∈S g i ∈ C. For each codeword c ∈ C let c S ∈ F k 2 denote the systematic part of c, i.e., the restriction of c to the first k coordinates c 1 , . . ., c k .Similarly, for each codeword c ∈ C let c I ∈ F t 2 denote the information bits, i.e., the restriction of c to the last t coordinates c k+1 , . . ., c k+t .Next, we study some properties of minimal codewords in general binary linear codes.= 0 and we can apply Lemma 2.3.
Corollary 2.5.Let c S be a minimal codeword.Then, we have Proof.The largest cardinality of a set of linearly independent vectors in F t 2 is t.Thus, if #S ≥ t+1, then there exists a subset T ⊆ S with c T I = 0 and #T ≤ t + 1.We finally apply Lemma 2.3 to conclude #S ≤ t + 1.
Proof.Since S = ∅ we have c S = 0.If c S is non-minimal, then there exists a subset ∅ = T S with supp(c T ) supp(c S ).Since c S I = 0 this implies c T I = 0.For the other direction we apply Lemma 2.3.
We have already observed that c S is minimal for all subsets S ⊆ {1, . . ., n} of cardinality 1.In a code C(G) obtained from a graph G also the case of cardinality #S = 2 can be characterized easily: Lemma 2.7.Let G = (V, E) be a graph and C = C(G) be its associated code.For S = {v 1 , v 2 } the codeword c S is minimal iff v 1 and v 2 have a common neighbor v 3 (where we assume that the vertices v 1 , v 2 , and v 3 are pairwise different).
Proof.If v 1 and v 2 do not have common neighbors, then supp c {v 1 } c S , so that c S is nonminimal.If v 1 and v 2 have a common neighbor v 3 then c S I has a one at position v 3 while c {v 1 } and c {v 2 } have a one at position v 3 , so that c S is minimal.
A path between two vertices u and v is a sequence of distinct vertices [v 0 , . . ., v l ], such that v 0 = u, v l = v, and {v i , v i+1 } is an edge for all 0 ≤ i < l.Such a path is called a shortest path if l is minimal.We also call l the length of the path.In a connected graph the length of the shortest path between two vertices gives a metric, i.e., the distance between two vertices is the length of a shortest path connecting them.The diameter of a connected graph is the maximum distance between pairs of vertices.Graphs of diameter 1 are called complete graphs and we will determine the corresponding number M (G) of minimal codewords in Proposition 3.1.For graphs with diameter 2 we have: Proof.For each subset S ⊆ V of cardinality 1 the codeword c S is minimal, which gives #V minimal codewords.Now consider the #V 2 subset S = {u, v} of cardinality 2. If {u, v} is not an edge in G, then u and v are at distance 2 in G.In other words, u and v have a common neighbor, so that we can apply Lemma 2.7 to deduce the minimality of c S .Since # , we obtain the stated lower bound.

The value of M(G) for some graph classes
Given the number n of vertices, we will always set V = {1, . . ., n} in this subsection.By K n we denote the complete graph on n vertices, i.e., V = {1, . . ., n} and E = {{i, j} : 1 ≤ i < j ≤ n}.Obviously, we have M (K 1 ) = 1 and M (K 2 ) = 2. Proposition 3.1.For each integer n ≥ 3 we have Proof.For some subset ∅ = S ⊆ {1, . . ., n} we can easily describe c S I .If #S ≡ 0 (mod 2), then c S I equals 1 at position v iff v ∈ S and 0 otherwise.In the other case, #S ≡ 1 (mod 2), we have that c S I equals 1 at position v iff v ∈ S and 0 otherwise.So, if the cardinality of S is even and at least four, then we can choose at subset T S of cardinality T with supp(C T I ) supp(c S i ), i.e., the codeword c S is non-minimal.If #S = 2, then we can apply n ≥ 3 and Lemma 2.7 to deduce that c S is minimal.This gives n 2 cases of minimal codewords.If #S = 1, then c S is minimal, which amounts to n = n 1 cases.Now let #S be odd and at least 3.We have c S I = 0 iff S = {1, . . ., n}.The only proper subset Proof.For some subsets A ′ ⊆ {1, . . ., a} and B ′ ⊆ {a + 1, . . ., a + b} with S := A ′ ∪ B ′ = ∅ we can easily describe c S I .The value of c S I at a position α ∈ A equals #B ′ rem 2, i.e., the remainder of #B ′ divided by 2. Similarly, the value of c S I at a position β ∈ B equals #A ′ rem 2. Every non-zero codeword can be written as c S for some subset ∅ = S ⊆ {1, . . ., a + b}.We decompose ) we again conclude that c S is not a minimal codeword.If #S = 1, then c S is a minimal codeword.If #S = 2, then we can apply Lemma 2.7 and conclude that c S is minimal iff either S ⊆ A or S ⊆ B.
Next we want to consider graph arising if we join the centers of two stars by an edge: So, c S is non-minimal in that case.By symmetry, the same is true for the b neighbors of v of degree 1.So, let x be an arbitrary neighbor of u of degree 1 and y be an arbitrary neighbor of v of degree 1.It suffices to consider S ⊆ {x, u, v, y}.In the following table we consider all choices for S and abbreviate c S I by just four binary entries.The second and third entry correspond to vertex u and vertex v, respectively.The first entry corresponds to vertex x or any other neighbor of u of degree 1, noting that those entries are all equal.Similarly, the fourth entry corresponds to vertex y or any other neighbor of v of degree 1.
For an integer r ≥ 1 and positive integers a 1 , . . ., a r we denote by K a 1 ,...,ar the complete multipartite graph, i.e., the vertex set of the n = r i=1 a i vertices is partitioned into r classes such that two vertices are connected by an edge iff the come from different classes.Proposition 3.5.For each complete multipartite graph G = K a 1 ,...,ar with r ≥ 3 we have where n = r i=1 a i .
Proof.Let us denote the r vertex classes by A 1 , . . ., A r .Given a non-empty subset S of the vertex set, we set A ′ i = A i ∩ S for all 1 ≤ i ≤ r.Let v ∈ A j for some 1 ≤ j ≤ r.Then, the value of c S I at position v is given by # (S\A j ) rem 2. If #S = 1, then c S is minimal.If #S = 2, then we can use Lemma 2.7 to deduce that c S is minimal.If #S ≥ 3 and # (S ∩ A j ) ≥ 2 for some index 1 ≤ j ≤ r, then we can choose a two-element subset U ⊆ S ∩ A j and use c S\U I ⊆ c S I to conclude that c S is non-minimal.It remains to consider the cases where #S ≥ 3 and # (S ∩ A i ) ≤ 1 for all 1 ≤ i ≤ r.Similar as in the proof of Proposition 3.1, we easily conclude that c S is minimal iff #S ≡ 1 (mod 2).
We remark that K n = K 1,...,1 , where the complete multipartite graph has exactly n vertex classes with cardinality 1 each.
For each integer n ≥ 2 we denote by P n the graph whose edges are given by E = {{i, i + 1} : 1 ≤ i ≤ n − 1}.The graph P n is also called a path of order n.Proposition 3.6.For each integer n ≥ 1 we have Proof.Each non-zero codeword of C(P n ) is given as c S for some subset ∅ = S ⊆ {1, . . ., n}.For #S = 1 the codeword c S is minimal.Given S, a maximal distance-2 chain U is a subset of S of the form U = {a, a + 2, . . ., b − 2, b}, where a ≡ b (mod 2) and a For a suitable integer r ≥ 1 let U 1 , . . ., U r be the unique decomposition of S into maximal distance-2 chains.We directly conclude that the supports of c U i and c U j are disjoint for all 1 ≤ i < j ≤ r.Thus, c S cannot be minimal if r ≥ 2 since supp c U i ⊆ supp c S and supp c U i = ∅ for 1 ≤ i ≤ r.Now suppose that S itself is a maximal distance-2 chain, i.Counting the maximal distance-2 chains gives Note that the formula for M (P n ) is also valid for the case For each integer n ≥ 3 we denote by C n the graph whose edges are given by E = {i, i + 1} : 1 ≤ i ≤ n − 1 ∪ {1, n} .The graph C n is also called a cycle of order n.With τ : Z → {1, . . ., n} being the unique mapping with τ (z) ≡ z (mod n) for all z ∈ Z, we can also write the edge set of C n as {τ (i), τ (i + 1)} : 1 ≤ i ≤ n .The proof of Proposition 3.6 can be adjusted slightly to determine M (C n ).For a suitable integer r ≥ 1 let U 1 , . . ., U r be the unique decomposition of S into maximal distance-2 chains.We directly conclude that the supports of c U i and c U j are disjoint for all 1 ≤ i < j ≤ r.Thus, c S cannot be minimal if r ≥ 2. Next we show that c S is minimal iff S is a (maximal) distance-2 chain itself.Each subset ∅ = T S has a decomposition into r ≥ 2 maximal distance-2 chains U 1 , . . ., U r , where # supp(c ).Thus, it remains to count the number of different maximal distance-2 chains U = {τ (a), τ (a + 2), . . ., τ (b − 2), τ (b)}.
If n is even, then the case τ (a−2) = τ (b) can occur exactly two times, i.e., for the cases {1, 3, . . ., n− 1} and {2, 4, . . ., n}.Otherwise, we can start at any vertex 1 ≤ a ≤ n and choose b = a + 2j, where 0 If n is odd, then the case τ (a − 2) = τ (b) occurs iff U = {1, . . ., n}.Otherwise, we can start at any vertex 1 ≤ a ≤ n and choose b = a + 2j, where 0 ≤ j ≤ n − 2. Thus, if n is odd, we have Note that the formula for M (C n ) is also valid for the case In a bipartite graph G we may generalizes the idea of a distance-2 chain as follows.We can build up a new graph G ′ with the same vertex set as G. Two vertices in G ′ are connected by an edge, by definition, if they are at distance exactly 2 in G. Similar as in the proof of Proposition 3.6 one can show that for each minimal codeword c S the set S induces a connected subgraph in G ′ .However, c S can be non-minimal for the vertex set S of a connected subgraph of G ′ , i.e., we may only conclude an upper bound on M (G).This e.g.happens in K a,b provided that a and b are large enough.
Another variant of a distance-2 chain can lead to lower bounds.Definition 3.1.In a graph G an even path between two vertices u and v is a sequence of distinct vertices [v 0 , . . ., v l ] such that v 0 = u, v l = v, l is an even positive integer, and {v i , v i+1 } is an edge for all 0 ≤ i ≤ l − 1.We call [v 0 , . . ., v l ] a shortest even path between u and b if l is minimal.
Note that even in a connected graph there does not need to exist a shortest even path for two given vertices.Moreover, in the case of existence it does not need to be unique.Lemma 3.8.Let G be a graph and C be the associated binary linear code.For each shortest even path [v 0 , . . ., v l ] the codeword c S , where S = {0 ≤ i ≤ l : i ≡ 0 (mod 2)}, is minimal.
Proof.As an abbreviation we set E = {0 ≤ i ≤ l : i ≡ 0 (mod 2)} and O = {0 ≤ i ≤ l : i ≡ 1 (mod 2)}.Let o ∈ O and e ∈ E such that {v o , v e } is an edge in G. Since l is minimal by assumption we have e ∈ {o − 1, o + 1}.Thus, for each o ∈ O the vertex v o has exactly two neighbors v e where e ∈ E. So, in c S I the entries at the positions v o for o ∈ O are equal to zero.Now let ∅ = T S = E be an arbitrary subset, t min be the minimal element in T , and t max be the maximal element in T .If t min > 0, then the entry at position v t min −1 in c T I is equal to one so that c T ⊆ c S .Similarly, if t max < l, then the entry at position v tmax+1 in c T I is equal to one so that again c T ⊆ c S .Since t min = 0 and t max = l imply T = S the codeword c S is indeed minimal.
Note that Lemma 2.7 says that for a two element subset S ⊆ {1, . . ., n} the codeword c S is exactly minimal if there exists a (shortest) even path of length 2 between the elements of S. Lemma 3.9.Let [v 0 , . . ., v l ] and v ′ 0 , . . ., v ′ l ′ be two shortest even paths.If Proof.First we note that l = l ′ .Now choose indices 0 ≤ i, j ≤ l such that v ′ 0 = v i and v ′ l = v j with i ≡ j ≡ 0 (mod 2).Depending on whether i < j or i > j, either [v i , v i+1 , . . ., v j ] or [v i , v i−1 , . . ., v j ] is an even path from v ′ 0 to v ′ l .Since we assume that l is the shortest possible length of such a path, we have {i, j} = {0, l}, i.e., {v We remark that in an odd cycle, i.e., C n where n is odd, the shortest even path between any two neighbored vertices uses all n vertices.Proof.Let C be the code C(G) induced by the graph G.For each of the n subsets S ⊆ {1, . . ., n} of cardinality 1 the codeword c S is minimal.These are a + b minimal codewords.Now consider two vertices u and v of the same color class in T .Due to the construction of the coloring, there exists an even path between u and v in T , which is also an even path between u and v in G.If the path is not already a shortest even path, then pick one.So, for every two vertices u and b of the same color class (in T ) there exists a shortest even path [v 0 , . . ., v l ] between u and v in G, so that Lemma 3.8 implies that c S is minimal, where S = {v i : 0 ≤ i ≤ l, i ≡ 0 (mod 2)}.There are a 2 + b 2 choices and by Lemma 3.9 all of them lead to different minimal codewords c S , where #S ≥ 2.
We remark that the lower bound of Lemma 3.10 is attained with equality in Proposition 3.2, i.e., for complete bipartite graphs, and in Proposition 3.4.In Theorem 4.1 we will use Lemma 3.10 to determine a formula for the minimum number m(n) of minimal codewords of a connected graph with n vertices.
An induced subgraph of a graph G = (V, E) is a graph whose vertex set is a subset S ⊆ V and whose edges are given by the elements of E where both vertices are contained in S. If G ′ = (V ′ , E ′ ) is an induced subgraph of G = (V, E) and c S a minimal codeword in G ′ , where S ⊆ V ′ , then c S is also a minimal codeword in G.An odd cycle is an induced subgraph that is isomorphic to C l , where l is odd.Proposition 3.11.Let G = (V, E) be a connected graph.If S ⊆ V induces an odd cycle in C, then c S is a minimal codeword in C(G).
Proof.Let G ′ = (S, E ′ ) be the subgraph induced by S and C = C(G ′ ) the binary code associated with G ′ .In C we have c S I = 0. We can easily check that c T I = 0 for all ∅ = T S, so that Lemma 2.6 gives that c S is minimal in C. As noted above, c S is also minimal in C(G).
Another lower bound, using more common graph invariants, for M (G) is: Lemma 3.12.Let G be a graph with n vertices, maximum degree ∆, and t triangles.Then, we have M (G) ≥ n + ∆ 2 + t.
Proof.For each of the n subsets S ⊆ {1, . . ., n} of cardinality 1 the codeword c S is minimal.If v is a vertex of degree ∆, then for any pair S of two neighbors of v we can apply Lemma 2.7 to deduce that c S is minimal.Note that there are ∆ 2 choices.If S consists of the three vertices of a triangle, then c S is minimal, see Proposition 3.11.
Next we want to study the special situation where all non-zero codewords are minimal.

Exact values for small parameters
The aim of this subsection is to determine the exact value of M (n) and m(n) for 1 ≤ n ≤ 10.Given Lemma 2.1 it suffices to consider connected graphs.We note that there are already 11 716 571 nonisomorphic connected graphs, which we have enumerated using the software package geng [14].For each connected graph G we determine M (G) by exhaustive enumeration.The maximum M (n) is attained for 3 ≤ n ≤ 6 by a complete graph K n , while the cases n ∈ {7, 8, 9, 10} need other constructions.For n = 10 there are 22 isomorphism types of graphs that attain the maximum of 682 minimal codewords.Those graphs are quite diverse, i.e., their number of edges lies between 21 and 32, the minimum degree is either 4 or 5, and the maximum degree ranges from 5 to 9. For 1 ≤ n ≤ 10, the minimum value m(n) is attained by a path P n .This observation is also true in general.

Lemma 2 . 3 .Lemma 2 . 4 .
Let ∅ = S ⊆ {1, . . ., k}.If there exists a subset ∅ = T S with c T I = 0, then c S is non-minimal.Proof.Since supp c S\T I = supp c S I and supp c S\T S supp c S S , we have supp c S\T supp c S .Let ∅ = S ⊆ {1, . . ., k}.The codeword c S is non-minimal iff there exists a subset ∅ = T S with supp(c T I ) ⊆ supp(c S I ).Proof.Since S = ∅ we have c S = 0. Thus, if c S is non-minimal, there exists a subset ∅ = T S with supp(c T ) supp(c S ), so that supp(c T I ) ⊆ supp(c S I ).For the other direction let ∅ = T S with supp(c T I ) ⊆ supp(c S I ).If supp(c T I ) = supp(c S I ), then supp(c T I ) supp(c S ) implies supp(c T ) supp(c S I ) so that c S is non-minimal by definition.If supp(c T I ) = supp(c S I ), then c S\T I Thus, c S is minimal and there are 1≤i≤n : i odd n i cases in total.Thus, we have M (K n ) = n 2 + 1≤i≤n : i odd n i , which can be simplified further.Since n i=0 n i = 2 n and n i=0 (−1) i n i = 0 the sum of odd binomial coefficients 1≤i≤n : i odd n i equals 2 n−1 , so that we obtain the proposed formula.For two positive integers we denote by K a,b the complete bipartite graph with vertex classes of size a and b, respectively, i.e., for A = {1, . . ., a} and B = {a + 1, . . ., a + b} we define the graph via V = A ∪ B and E = {{α, β} : α ∈ A, β ∈ B}.Proposition 3.2.For positive integers a, b we have

Proposition 3 . 4 . 2 + b+1 2 .
Let G be a graph with two vertices u and v that are joined by an edge.The other a + b vertices, where a, b ≥ 1, are vertices of degree 1, where a of them have u as their unique neighbor and the other b of them have v as their unique neighbor.With this, we have M (G) = 2 + a + b + a+1 Proof.By n = 2 + a + b we denote the number of vertices of the graph and by C the code C(G) associated to G.For each subset S ⊆ {1, . . ., n} of cardinality 1 the codeword c S is minimal.For subsets S of cardinality 2 we apply Lemma 2.7.Counting the number of pairs of vertices with a common neighbor gives a+1 2 + b+1 2 choices.It remains to show that c S is non-minimal if #S ≥ 3. First we note c T I = c S I if S arises from T by adding two of the a neighbors of u of degree 1.

Lemma 3 . 10 .
Let G be a connected graph and T be a spanning tree of G. Considering T as a bipartite graph, we denote the number of vertices in the two color classes by a and b.With this, we have M (G) ≥ a + b + a 2 + b 2 .

Theorem 4 . 1 . 2 + n−a 2 = a 2 − 2 , 4 . 4 to (n+1) 2 4
For each integer n ≥ 1 we have m(n) = (n + 1) Due to Proposition 3.6 it remains to show the corresponding lower bound.To this end we apply Lemma 3.10.Setting b = n − a we obtain the lower bound n + a na + n(n+1) which is a quadratic polynomial in a.Over the real numbers the minimum is attained for a = n/2, which gives m(n) ≥ n(n+2) If n is even this matches the statement.If n is odd we can uproundn(n+2) since m(n) is an integer.We remark that all connected graphs G with n vertices and M (G) = m(n) are bipartite, since Proposition 3.11 would give an additional minimal codeword that is not counted in Lemma 3.10.If T is a tree such that all vertices with degree strictly larger than 1 are contained on a path, then it can be easily shown that the lower bound of Lemma 3.10 is attained with equality.If the cardinalities of the two color classes of the bipartite tree T differ by at most 1, then we have M (T ) = m(n), where T consists of n vertices.We remark that one can also construct connected graphs G that contain 4-cycles and satisfy M (G) = m(n) for their number n of vertices.The determination of M (n) and the description of an infinite family of graphs attaining M (G) = M (n) is an interesting open problem.