A=GraphData[{"Path",5},"AdjacencyMatrix"]//Normal;
A//MatrixPlot
A//GraphPlot[#,VertexLabeling->True]&
Length[A]

Number of walks the old - fashioned way

MatrixPower[A,10]//Total[#,2]&

Number of walks the cool way

nw[k_,n_]:=(((2^(k+1)) (∑_(l=1)^(Ceiling[(n+1)/2]))((Cot[(((2 l-1) π)/((n+1) 2))])^2) ((Cos[(((2 l-1) π)/(n+1))])^k))/(n+1));
nw[10,5]//N

nw[k_,n_]:=((2^(k+1))/(n+1))Table[((Cot[((2l-1)/(n+1))(Pi/2)])^2) ((Cos[((2l-1)/(n+1))π])^k),{l,1,Ceiling[((n+1)/2)]}];

nw[2,5]

nw[3,5]//Simplify

(((2+(Sqrt[3])))^2)+(((2-(Sqrt[3])))^2)//Simplify