# How is the (local) clustering coefficient defined for vertices with degree 1

We want to compute the clustering coefficient $C$ for an undirected graph $G = (V, E)$.

The clustering coefficient $C$ for a graph $G$ is the average over all local clustering coefficients $C_i$, whereby $C_i$ is the local clustering coefficient of a vertex $v_i$ such that $i$ is a generic index and $v_i$ is a member of the network, i.e. $v_i \in V$.

The local clustering coefficient $C_i$ is defined as the ratio between the number of existing edges within the neighborhood of a vertex and the number of possible edges within the neighborhood of a vertex. Therefore, $C_i = \frac{2n}{k_i (k_i -1)}$, such that $n$ is the number of edges within the neighborhood of vertex $v_i$ and $k_i$ is the degree of vertex $v_i$.

For vertices with $k_i = 1$, the denominator becomes $0$ and the whole term becomes undefined.

Given that the clustering coefficient is the ratio between the number of possible edges in the neighborhood of a vertex and the actual number of edges, a vertex with $k_i = 1$ cannot have any edges within its neighborhood, as there no such neighborhood. Hence, is it reasonable to use $C_i = 0$ in cases where $k_i = 1$?

Yes, it is reasonable and common to have $C_i = 0$ when $k_i < 2$. This is sometimes a matter of taste, and some software libraries like igraph lets the user define how to handle the small-degree cases (i.e., whether to return 0 or NaN).