TwoD[20];
NeighborCounts[%]
{1,4,10,19,31,46,64,85,109,136,165,194,222,249,275,300,324,347,369,390,400,400}
NeighborCounts[%24,200,25]
{1,4,10,19,31,46,64,85,109,136,165,194,222,249,275,300,324,347,369,390,400,400,400,400,400,400}
ShortestPath[g_,{i0_,i1_}]:=Module[{gp=Dispatch[NetworkToRuleList[g]],d=0,nn={i0}},While[!MemberQ[nn,i1],nn=Union[Flatten[nn/.gp]];d++];d]
Table[ShortestPath[%24,{1,i}],{i,20}]
{0,3,4,7,8,11,12,15,16,19,20,17,16,13,12,9,8,5,4,2}
TwoD[10];
Length[%]
100
Table[ShortestPath[TwoD[10],{1,i}],{i,0,99}]
{1,0,3,4,7,8,9,8,5,4,2,1,2,5,6,9,10,7,6,3,3,2,3,4,7,8,9,8,5,4,4,3,4,5,6,9,10,7,6,5,5,4,5,6,7,8,9,8,7,6,6,5,6,7,8,9,10,9,8,7,5,4,5,6,7,8,9,8,7,6,4,3,4,5,6,9,10,7,6,5,3,2,3,4,7,8,9,8,5,4,2,1,2,5,6,9,10,7,6,3}
ListPlot[%,PlotJoined->True];
ListPlot[Length/@Split[Sort[%40]],PlotJoined->True,PlotRange->All]
⁃Graphics⁃
ListPlot[NeighborCounts[TwoD[10],1],PlotJoined->True]
⁃Graphics⁃
NumberOfPaths[g_,{i0_,i1_},dmax_]:=NeighborLists[g,i0,dmax]
Should not do Union at each step....