For the case of source-target pairs (as opposed to source to all other vertices), using a modification of Szabolcs's step
to avoid vertices that, if taken, will take us too far from the target vertex (too far to reach the target within remaining number of steps) gives us all walks from source to target vertex with specified length directly (without the need to filter all walks to get the ones that end in the target vertex):
ClearAll[steps, walks, adjl, dist]
adjl[g_] := GroupBy[EdgeList[g], First -> Last]
dist[g_, t_]:= Association[# -> GraphDistance[g, #, t]& /@ VertexList[g]]
steps[g_, l_, t_][{most___, last_}] := {most, last, #} & /@
Select[dist[g, t][#] <= l - Length[{most, last}] &] @ adjl[g][last]
walks[g_, s_, t_, l_] := Nest[Join @@ steps[g, l, t] /@ # &, {{s}}, l ]
walks[g, 0, 2, 6]
{{0, 1, 2, 3, 0, 1, 2}, {0, 1, 2, 2, 2, 2, 2}, {0, 1, 1, 2, 2, 2,
2}, {0, 1, 1, 1, 2, 2, 2}, {0, 1, 1, 1, 1, 2, 2}, {0, 1, 1, 1, 1, 1, 2}, {0, 0, 1, 2, 2, 2, 2}, {0, 0, 1, 1, 2, 2, 2}, {0, 0, 1, 1, 1, 2, 2}, {0, 0, 1, 1, 1, 1, 2}, {0, 0, 0, 1, 2, 2, 2}, {0, 0, 0, 1, 1, 2, 2}, {0, 0, 0, 1, 1, 1, 2}, {0, 0, 0, 0, 1, 2, 2}, {0, 0, 0, 0, 1, 1, 2}, {0, 0, 0, 0, 0, 1, 2}}
This matches the list obtained by filtering all walks computed using Szabolcs's step
:
Sort @ walks[g, 0, 2, 6] == Sort @ Cases[{__, 2}] @ Nest[Join @@ step /@ # &, {{0}}, 6]
True