[Math] Distribution of the shortest path length – Why is 0 counted here

graph theory

I am using a graph tool that can plot the distribution of the shortest path length.
Assume the graph looks like this:

graph example

If I try to plot the shortest path length distribution of the graph above, the tool returns:

Jumps    Num. shortest paths
0   5
1   3
2   1

I don't understand why the number of jumps of 0 has 5 number of shortest paths. What I assume is that it counts the nodes. But this is strange, since I don't have any self-loops. Is there anything else I'm missing?

Edit:

Stupid me (assuming that I figured it out)… It actually makes sense right? There are 0 number of jumps for 5 number of shortest paths.. So it does count the nodes.. But why is that useful information?

Edit 2:

It doesn't make any sense, if I add the edge (0,0) (self-loop), the number is still 5. I expected it to be 4 (because of the self-loop). Even more strange: the self-loop isn't counted at all (the number of jumps for 1 is still 3).

Best Answer

In you graph the shortest path between node $i$ and node $i$ is 0 (because it is the same node), and these paths have 0 hops (number of nodes of a path, excluding the first node, or number of edges of the path, i.e length of the path).

You have 3 paths of minimum length 1 ($0 \to 1$, $1 \to 2$, $3 \to 4$), and $1$ shortest path of length 2 (the one between nodes $0$ and $2$).

About you edit 2:

If you add a self-loop on the node $0$, you will have several paths from $0$ to $0$, including the trivial path of length $0$ and the path taking the self-loop, on length $1$. However this path of length $1$ is not a shortest path and therefore is not counted.