# WALK POLYNOMIAL: A New Graph Invariant

Open access

## Abstract

In this paper we introduce the walk polynomial to find the number of walks of different lengths in a simple connected graph. We also give the walk polynomial of the bipartite, star, wheel, and gear graphs in closed forms.

## Abstract

In this paper we introduce the walk polynomial to find the number of walks of different lengths in a simple connected graph. We also give the walk polynomial of the bipartite, star, wheel, and gear graphs in closed forms.

## 1 Introduction

Several graph polynomials have been introduced so far, as the chromatic polynomial [2], the Tutte polynomial, the Hosoya polynomial, and the M-polynomial. All these polynomials play important roles in graph theory, particularly due to their applications. The chromatic polynomial counts the number of distinct ways to color a graph with a number of given colors. The Tutte polynomial [5] became popular because of its universal property that any multiplicative graph invariant with a deletion-contraction reduction must be an evaluation of it. The Hosoya polynomial [4] counts the number of paths of different lengths in a molecular graph, and now plays a key role to find distance-based topological indices. The M-polynomial [3] plays a crucial role for degree-based topological indices parallel to the role the Hosoya polynomial plays for distance-based invariants.

In this paper we introduce the walk polynomial to find the number of walks of different lengths in a graph. We not only give a way of computing it but also give walk polynomial of the bipartite, star, wheel, and gear graphs.

## 2 Preliminaries

A graph G is a pair (V, E), where V = {v1, v2, …, vn} is the set of vertices and E = {e1, e2, …, vm} is the set of edges. An edge e between two vertices u and v is denoted by e = (u, v).

A path from a vertex v to a vertex w is a sequence of vertices and edges that starts from v and stops at w. The number of edges in a path is the length of that path. A graph is said to be connected if there is a path between any two of its vertices. The distance d(u, v) between two vertices u, v of a connected graph G is the length of a shortest path between them. The diameter of G, denoted by d(G), is the longest distance in G.

Definition 2.1

A walk between two vertices u and v of G is finite alternating sequence u = v0, e1, v1, e2, v2, e3, v3, …, ek, vk = v of vertices and edges of G such that the edge ei joins the vertices vi–1 and vi.

Theorem 2.2

[1] If A is the adjacency matrix of simple graph G, then the entry aijAk is the number of different walks of length k between the vertices i and j.

In the following we introduce the walk polynomial as a new graph invariant, a function which assigns a single value to all isomorphic graphs.

Definition 2.3

The walk polynomial in variable x of a simple connected graph G is defined as

$W(G,x)=12∑k=1d(G)(∑aij∈Akaij−tr(Ak))xk,$

where A is the adjacency matrix of G.

## 3 Main Results

In this section we give the walk polynomial of the complete bipartite, star, wheel, and gear graphs.

First of all we give the walk polynomial of the complete bipartite graph Km,n.

Theorem 3.1

The walk polynomial of the complete bipartite graph Km,n, m ≥ 2, n ≥ 1, is 𝓦 (Km,n) = mnx1 + $mn2(m+n−2)x2.$

Proof

Since the diameter of Km,n is 2, we need only two matrices, the adjacency matrix A and its square matrix A2. In order to give the total number of walks of lengths 1 and 2, we first give the general forms of A and A2. The (m + n) × (m + n) adjacency matrix corresponding to Km,n is

$A=Om,mJm,nJm,nTOn,n,$

where O and J are respectively matrices of zeros and ones. It is better to see the adjacency matrix of the bipartite graph k2,4:

$A=001111001111110000110000110000110000$

Since the upper triangular part of the adjacency matrix A is the matrix Jm,n, the sum of entries of this matrix is mn. Thus the number of all walks of length 1 in Jm,n is w1 = mn. Similarly, the general form of A2 is

$A2=nJm,mOm,nOm,nTmJn,n,$

where n(Jm,m) represents the multiplication of J with the number n. The following is the second power of the adjacency matrix of the bipartite graph k2,4.

$A2=440000440000002222002222002222002222$

The number w2 of walks of length 2 in Km,n is $w2=12$ [the sum of entries of, $nJm,m−tr(nJm,m)]+12$ [the sum of entries of mJn,ntr $(mJn,n)]=12[n(m2)−n(m)]+12[m(n2)−m(n)]=mn2[m+n−2].$ This completes the proof. □

The following result gives the walk polynomial of the star graph Sn.

Theorem 3.2

Let Sn represent the star graph. Then $W(Sn)=(n−1)x1+12(n2−3n+2)x2.$

Proof

Since the diameter of Sn is 2, we need only two matrices, the adjacency matrix A and its square matrix A2, each of order n × n:

$A=O1,1J1,n−1J1,n−1TOn−1,n−1,$

where O and J are matrices of zeros and ones, respectively. You can see the adjacency matrix of S7:

$A=0111111100000010000001000000100000010000001000000$

Since the upper triangular part of the adjacency matrix A is the matrix J1,n–1, the sum of entries of this matrix is n–1. Thus the number of all walks of length 1 in J1,n–1 is w1 = n–1. Similarly, the general form of A2 is

$A2=(n−1)J1,1O1,n−1O1,n−1TJn−1,n−1,$

where n(J1,1) represents the multiplication of J1,1 with the number n–1. The following is the second power of the adjacency matrix of S7.

$A2=6000000011111101111110111111011111101111110111111$

Note that the walks of length 2 the contribution comes only from the matric Jn–1,n–1, and in this case the sum of all entries of this matrix is (n–1)2. Now the number of walks of length 2 in Sn is

$w2=12[the sum of entries ofJn−1,n−1−tr(Jn−1,n−1)]=12[(n−1)2−(n−1)]=12[n2−3n+2],$

and the proof is finished.

In the following we are going to give walk polynomial of the wheel graph Wn.

Theorem 3.3

The walk polynomial of wheel graph is 𝓦(Wn) = (2n–2)x1 + 1/2(n2 + 3n–4)x2 for n ≥ 3 with 2n–2 edges and n vertices.

Proof

Here, again, the diameter of the wheel graph is 2. So, again, we need just two matrices, the adjacency matrix A and its square A2. The adjacency matrix corresponding to Wn is A = (aij), where

$aij=0,i=j1,i=1orj=11,j=i+1ori=j+11,i=2,j=nandi=n,j=20,otherwise.$

$A=0111111101000111010001010100100101010001011100010$

You can see that there are three types of entries where nonzero entries appear; the nonzero entries are actually 1s. The first type of entries appear at positions where either i = 1 or j = 1, and their count is 2(n–1); The second type of entries appear at positions where either i = j + 1 or j = 1 + 1, and their count is 2((n–1)–1); The third type of entries appear at positions where either i = 2, j = n or i = n, j = 2, and their count is 2. You may observe that all the entries of main diagonal are 0. So, the number of all distinct walks of length 1 in Wn is $w1=12(2(n−1))+2((n−1)−1))+2=2(n−1).$ The upper triangular entries of A2 = (bij) are

$bij=1,j=i+1,i=2,…,n−11,i=2,j=n2,j=i+2,i=2,…,n−22,i=2,j=n−12,i=3,j=n−12,i=1,j=2,…,n1,j=i+3,…,i+(n−4),2≤i≤n−3,i+n−4≤n$

The following is A2 of W7.

$A2=6222222231212121312122213121212131222121312121213$

Now we give the sum of all the entries: and the first type of entries are all 1s and appear at the positions where j = i + 1, and their count is (n–2). The second type of entries are all 1s and appear at the positions where i = 2, j = n, and their count is 1. The third type of entries are all 2s and appear at the positions where j = i + 2, i = 2 and their count is (n–3); The fourth type of entries are all 2s and appear at the positions wherei = 2, j = n–1, and their count is 1; the fifth type of entries are all 2s and appear at the positions where i = 3, j = n–1, and their count is 1; the sixth type of entry is are all 2s and appear at the positions where i = 1, j = 2, …, n, and their count is (n–1); the seventh type of entries are all 1s and appear at the positions where j = i + 3, …, i + (n–4), 2 ≤ in–3, i + n–4 ≤ n, and their count is $∑4n−3(n−i).$. You may observe that all the entries are of upper triangular entries. So, the number of all distinct walks of length 2 in Wn is $w2=((n−2)+1+(n−3)+1+1+(n−1)+∑4n−3(n−i))=12(n2+3n−4)$

In the following we are going to give walk polynomial of the gear graph Gn.

Theorem 3.4

The walk polynomial of the gear graph Gn, n ≥ 6, is

$W(Gn)=3nx1+(n2+7n2)x2+(3n2+12n)x3+(n3+15n2+24n2)x4.$

Proof

Since the diameter of the gear graph is 4, we need four matrices, A, A2, A3, and A4.

Walks of lengths 1: Since only the upper-triangular entries contribute towards the walk polynomial, we give only the nonzero upper-triangular entries of the (2n + 1) × (2n + 1) adjacency matrix A = (aij) of Gn:

$aij=1,i=1,…,2n−1,j=i+11,i=1,j=2n1,i=odd,i<2n+1,j=2n+10,otherwise.$

Let us have a look at the adjacency matrix of G7:

$A=010000000000011101000000000000010100000000001001010000000000000101000000001000010100000000000001010000001000000101000000000000010100001000000001010000000000000101001000000000010100000000000001011100000000000100101010101010100$

You can see that there are three types of entries where nonzero entries appear; the nonzero entries are actually 1s. The first type of entries appear at positions where i = 1, …, 2n–1 and j = i + 1, and so their count is 2n–1; the second type of entries appear at positions where i = 1 and j = 2n, and so their count is 1; the third type of entries appear at positions where i is odd and is less than 2n + 1 and j = 2n + 1, and so their count is n. So, the number of all distinct walks of length 1 in Gn is w1 = ((2n–1) + 1 + n) = (3n).

Walks of lengths 2: Now we find walks of lengths 2. The upper triangular entries of A2 = (bij) are

$bij=2,i=odd,1≤i≤(2n−3),j=i+21,i=even,2≤i≤(2n−2),j=i+22,i=even,2≤i≤(2n),j=2n+11,i=odd,1≤i≤(2n−5),j=i+41,i=odd,1≤i≤(2n−7),j=i+61,i=odd,1≤i≤3,j=i+82,i=1,j=2n−11,i=2,j=2n$

For better understanding you may have a look at the walks of lengths 2 in the matrix A2 of G7.

$A2=302010101010200020100000000012203020101010100010201000000002102030201010100000102010000002101020302010100000001020100002101010203020100000000010201002101010102030200000000000102012201010101020300010000000001022020202020202027$

Now we give the sum of all these entries. The first type of entries are all 2s and appear at positions where i is odd and 1 ≤ i ≤ (2n–3), j = i + 2, and their count is (n–1). the second type of entries are all 1s and appear at positions where i is even and 2 ≤ i ≤ (2n–2) and j = i + 2, and their count is (n–1); the third type of entries are all 2s and appear at positions where i is even and 2 ≤ i ≤ (2n) and j = 2n + 1, and their count is n; the fourth type of entries are all 1s and appear at positions where i is odd and 1 ≤ i ≤ (2n–5) and j = i + 4, and their count is n–2; the fifth type of entry is are all 1s and appear at positions where i is odd and 1 ≤ i ≤ (2n–7) and j = i + 6, and their count is (n–3); the sixth type of entries are all 1s and appear at positions where i is odd and 1 ≤ i ≤ 3 and j = i + 8, and their count is (n–4); the seventh type of entries are all 2s and appear at positions where i = 1, j = 2n–1, and their count is 1. The eighth type of entries are all 1s and appear at positions where i = 2, j = 2n, and their count is 1. So, the number of all distinct walks of length 2 is $w2=n2+7n2.$

Walks of lengths 3: In order to find walks of length 3, we need upper triangular entries of the matrix A3:

$cij=5,1≤i≤(2n−1),j=i+13,1≤i≤3,j=i+(2n−3)3,1≤i≤2n−3,j=i+32,1≤i≤2n−5,j=i+52,1≤i≤2n−7,,j=i+75,i=1,j=n−1n+4,iis odd,1≤i<2n+1,j=2n+1$

The following is the matrix A3 of G7.

$A3=05030202020305115050302020203000505030202020311305050302020200030505030202021120305050302020002030505030202112020305050302000202030505030211202020305050300020202030505031130202020305050003020202030505115030202020305001101101101101101101100$

Now we give the sum of all entries of above diagonals. The first type of entries are 2s. These entries appear in n–4 secondary diagonals, and the entries appear as follows:

$cij=2,1≤i≤2n−5,j=i+52,1≤i≤2n−7,j=i+7⋮⋮2,1≤i≤5,j=i+(2n−5)$

Since the number of 2s appearing at these positions is n(n–4), their sum is 2n(n–4).

The second type of entries are 5s. These numbers appear on secondary diagonal with 1 ≤ i ≤ 2n–1 and j = i + 1, and their count is 2n–1. Moreover, one 5 appears at the position where i = 1, j = 2n. Since the total number of 5s is 2n, their sum is 10n.

The third type of entries are 3s. These entries appear only in 2 secondary diagonals, and their positions are:

$cij=3,1≤i≤3,j=i+(2n−3)3,1≤i≤2n−3,j=i+3$

Since the total number of 3s is 2n, their sum is 6n.

The fourth type of entries are n + 4s and appear at positions where i is odd and 1 ≤ i < 2n + 1 and j = 2n + 1. Since their count is n, the sum of these numbers is n(n + 4).

Finally, the number of all distinct walks of length 3 in Wn is 2n(n–4) + 10n + 6n + n(n + 4) = 3n(n + 4).

Walks of lengths 4: Now we go for distinct walks of length 4 by giving upper triangular entries of the matrix A4 = (dij). You may observe that these entries will form secondary diagonals, which are divided into three types:

Type I.

$dij=n+12,i=odd,1≤i≤(2n−3),j=i+28,i=even,2≤i≤(2n−2),j=i+2n+9,i=odd,1≤i≤(2n−5),j=i+45,i=even,2≤i≤(2n−4),j=i+4n+8,i=odd,1≤i≤(2n−7),j=i+64,i=even,2≤i≤(2n−6),j=i+60,otherwise$

Type II. The last two nonzero secondary diagonals are:

$dij=n+12,i=1,j=2n−18,i=2,j=2nn+9,i=1,j=2n−35,i=2,j=2n−2n+9,i=3,j=2n−15,i=4,j=2n$

Type III. There are n–5 secondary diagonals such that the first entry of each of these diagonals is n + 8. In the following m denotes the number of such diagonals, i.e., 1 ≤ mn–5.

$dij=n+8,i=odd,1≤i≤2(n−m)−5,j=2(m+2)+i4,i=even,1≤i≤2(n−m−2),j=2(m+2)+i$

The entries which are not covered yet are the entries of the last column of A4:

$dij=2n+8,i=even,2≤i≤2n,j=2n+1$

The following is the matrix A4 of G7.

$A4=21019016015015016019000100805040405082219021019016015015016000801008050404052216019021019016015015000508010080504042215016019021019016015000405080100805042215015016019021019016000404050801008052216015015016019021019000504040508010082219016015015016019021000805040405080102202202202202202202202277$

Now we give the sum of all these upper-triangular entries. There are four diagonals that appear once in the matrix. The entries of the first such diagonal are n + 12 and 8 and each of these appear n–1 times, and so there sum is (n–1)(n + 12) + 8(n–1). The entries of the second such diagonal are n + 9 and 5 and each of these appear n–2 times, and so there sum is (n–2)(n + 9) + 5(n–2). The entries of the third such diagonal are n + 9 and 5 and each of these appear 2 times, and so there sum is 2n + 28. The entries of the fourth such diagonal are n + 12 and 8 and each of these appears 1 time, and so there sum is n + 20.

Now we find the sum of those n–5 diagonals whose entries are same but appear with different number of times. Each such diagonal has two types of entries, n + 8 and 4. The largest of these diagonals contains n–3 entries of value n + 8, the next contains n–4 entries of value n + 8, and so on the last such diagonal contains 3 entries. Thus the sum of all these entries is

$Sum1=(n−3)(n+8)+(n−4)(n+8)+⋯+(3)(n+8)=(n+8)[(n−3)+(n−4)+⋯+3]=n2(n+8)(n−5).$

Similarly, since 4 appears the same number of times the n + 8 appears, their sum is Sum2 = 2n(n–5).

Since the entries 2n + 8 in the last column appear n times, their sum is n(2n + 8).

Finally, the sum of all upper-triangular entries of A4 is

$w4=[(n−1)(n+12)+8(n−1)]+[(n−2)(n+9)+5(n−2)]+[2n+28]+[n+20]+n2(n+8)(n−5)+2n(n−5)+n(2n+8)=12[n3+15n2+24n].$

Corollary 3.5

The walk polynomial of the Jahangir graph J2,m, m ≥ 6, is

$W(J2,m)=3mx1+(m2+7m2)x2+(3m2+12m)x3+(m3+15m2+24m2)x4.$

Proof

Just substitute m for n in the walk polynomial of the gear graph Gn.

Communicated by Juan L.G. Guirao

Funding: Not applicable.

Authors’ Contribution: All authors contribute equally in this paper.

Competing Interests: The author(s) do not have any competing interests in the manuscript.

Acknowledgement

Not applicable.

## References

• [1]

V. K. Balakrishnan, Graph Theory, McGraw-Hill, New York, 1997.

• [2]

G. D. Birkhoff, A Determinant Formula for the Number of Ways Coloring a Map, Annal. Math., 14(2) (1912): 42-46.

• [3]

E. Deutsch and S. Kavžar, M-polynomial and degree-based topological indices, Iran. J. Math. Chem., 6 (2015), 93-102.

• [4]

H. Hosoya, On Some Counting Polynomials in Chemistry, Discr. Appl. Math. 19 (1988), 239-257.

• [5]

W. T. Tutte, A Contribution to the Theory of Chromatic Polynomials, Canadian J. Math., 6 (1954), 80-91.

[1]

V. K. Balakrishnan, Graph Theory, McGraw-Hill, New York, 1997.

[2]

G. D. Birkhoff, A Determinant Formula for the Number of Ways Coloring a Map, Annal. Math., 14(2) (1912): 42-46.

[3]

E. Deutsch and S. Kavžar, M-polynomial and degree-based topological indices, Iran. J. Math. Chem., 6 (2015), 93-102.

[4]

H. Hosoya, On Some Counting Polynomials in Chemistry, Discr. Appl. Math. 19 (1988), 239-257.

[5]

W. T. Tutte, A Contribution to the Theory of Chromatic Polynomials, Canadian J. Math., 6 (1954), 80-91.

# Applied Mathematics and Nonlinear Sciences

### Metrics

All Time Past Year Past 30 Days
Abstract Views 0 0 0
Full Text Views 180 180 33