I'm reading through the following chapter and would like to prove their claim, that for a ring lattice, with parameter $k$. That means each nodes is connected to neighbours that are $k$ or fewer nodes away. Now they claim that the clustering coefficient is given by
$$\frac{3k-3}{4k-2}$$
which I don't really understand. I know that for undirected graphs it holds that the local cluster coefficient (which is here the global one, as every node has the same local cluster coefficient) is given by
$$ \frac{2n(i)}{d_i(d_i-1)} $$
where $d_i$ is the degree of node $i$ and $n(i)=|\{(k,j)| (i,j)\in E \wedge (i,k)\in E\}|$. For this kind of graph I would have thought that $d_i = 2k$ and $n(i) = 2k - 2$, the latter being the two far most nodes away from node $i$ are not connected anymore if we move one to the right/left. However, this would give
$$\frac{2n(i)}{d_i(d_i-1)} = \frac{2(2k-2)}{2k(2k-1)}=\frac{2k-2}{k(2k-1)} $$
which seems not to match the above claim. Where is my mistake?
According to the notes you referred to, the clustering coefficient for a node $i$ is $$C(i)=\frac{\text{the number of actual edges between the neighbors of }i}{\text{the number of all possible edges between the neighbors of }i}$$ Note that the denominator in the fraction is exactly $d_i(d_i-1)/2$. So the $n(i)$ in your expression $\frac{2n(i)}{d_i(d_i-1)}$ should represent the number of actual edges between the neighbors of $i$.
Your mistake is the claim that $n(i)=2k-2$ for a node $i$ in the ring lattice with parameter $k$.
In fact, the claim that $$C(i)=\frac{3k-3}{4k-2}$$ is only true when $3k<n$, which I will explain later.
Let $E^*(i)$ be the set of actual edges between the neighbors of node $i$. That is, $$E^*(i)=\{(j,k) | (j,k)\in E, (i,j)\in E, \text{ and } (i,k)\in E\}.$$ Clearly, $|E^*(i)|=n(i)$.
For ease of explanation, let's label the nodes in the ring lattice consecutively with integers from $0$ to $n-1$. Say we want to compute the clustering coefficient of node $0$. The image below shows the labeling of the neighbors of node $0$.
Starting from node $k$ which is on the far right, for each neighbor of node $0$, count how many neighbors it has on the left in the image above, excluding node $0$.
Now assume that the neighbors of node $k$ on its right do not coincide with any of the nodes in $\{n-k, \dots, n-1\}$. That is, $k+k=2k<n-k$, which is equivalent to $n>3k$.
In this case, node $k$ has exactly $k-1$ neighbors on its left excluding node $0$. (They are $\{1, \dots, k-1\}$.) In other words, there are exactly $k-1$ edges in $E^*(i)$ that are incident to node $k$.
Next, the node $k-1$ also has exactly $k-1$ neighbors on its left excluding node $0$. (They are $\{n-1, 1, \dots, k-2\}$.) We do not have to consider the neighbor of node $k-1$ on the right because the edge between node $k-1$ and node $k$ has already been counted in the preceding paragraph.
Similarly, you can see that each node in $\{1,\dots, k\}$ has exactly $k-1$ neighbors on its left excluding node $0$.
Next consider the nodes in $\{n-1,\dots, n-k\}$. Notice that node $n-1$ has $k-1$ neighbors on its left. (They are $\{n-k, \dots, n-2\}$.) Node $n-2$ has $k-2$ neighbors on its left. (They are $\{n-k, \dots, n-3\}$.) Similarly, you can see that each node $n-j$ has exactly $k-j$ neighbors on its left, where $j\in \{1,\dots, k\}$.
Adding up all those counts will give the exact number of edges between the neighbors of node $0$, which is the $n(i)$ in your equation.
So $$n(i)=\frac{3}{2}k(k-1)$$ and hence $$C(i)=\frac{2n(i)}{d_i(d_i-1)}=\frac{2}{2k(2k-1)}\left(\frac{3k(k-1)}{2}\right)=\frac{3k-3}{4k-2}.$$
Note: The above equation does not hold if $n\leq 3k$. For example, consider the ring lattice with parameter $n=10$ and $k=4$.