Suppose I have a network of computers arranged in a line, like in the image I made below.
I want to know the total number of hops possible.
For example, $A$ gets to $B$ in $1$ hop, to $C$ in $2$ and to $D$ in $3$.
$B$ and $C$ are a little different, they get to the others in $1$, $1$ and $2$ hops.
$D$ is like $A$.

In this case, with four computers, the total number of possible hops is 20. But how can I generalize the computation of this for $n$ computers in a line?
@Imray;
I am getting
for A -> B -> C -> D -> E
$$1+2+3+4=10$$
$$1+2+3 = 6$$
$$1+2=3$$
$$1=1$$
10 + 6 + 3 + 1 = 20 and now there is the reverse direction, 2 * 20 = 40
This pattern repeats itself so doing the summation:
$$2 \sum _{k=1}^{n-1} \left(\sum _{m=1}^k m\right)=\frac{1}{3} (n-1) n (n+1)$$
$$f(n)=\frac{1}{3} (n-1) n (n+1)$$