What exactly does LocalClusteringCoefficient compute for directed graphs?

For undirected graphs, the LocalClusteringCoefficient of vertex v is

What precisely does Mathematica compute for directed graphs? The documentation states that this function supports directed graphs.

To take an example, can someone explain the result 1/2 for vertex 1 here?

g = Graph[{1, 2, 3, 4}, {1 -> 2, 2 -> 3, 3 -> 1, 1 -> 4},
VertexLabels -> "Name"] LocalClusteringCoefficient[g]
(* {1/2, 1, 1, 0} *)

What about 1/3 here?

g = Graph[{1, 2, 3, 4}, {1 -> 2, 2 -> 3, 3 -> 1, 1 -> 4, 4 -> 1},
VertexLabels -> "Name"]

LocalClusteringCoefficient[g]
(* {1/3, 1, 1, 0} *)

Also asked on Wolfram Community.

• I'm really not sure what it calculates, I just want to add that GraphDensity[Subgraph[g, AdjacencyList[g, v]]] works for directed graphs as well as mentioned in the reference for GraphDensity and seems to give the correct results for both cases. – Graumagier Dec 7 '15 at 12:05
• @Graumagier Well, "correct" depends on how we define the local clustering coefficient :) GraphDensity[Subgraph[g, AdjacencyList[g, v]]] "works" (as in it returns some well defined result) for directed graphs, but it's good to remember that AdjacencyList ignores edge directions while GraphDensity doesn't. This is reasonable, but another potential definition would be to only consider neighbouring vertices along out-edges (not in-edges), or something similar. Thanks for looking at the question! – Szabolcs Dec 7 '15 at 12:20
• My best guess is that it's computing the cyclic clustering coefficient $C_i^{cyc}$, see p.13 of this paper. – ilian Dec 11 '15 at 0:11
• @ilian Yes, you are correct! How did you find that? Did I miss something in the documentation? – Szabolcs Dec 11 '15 at 7:28
• @Szabolcs Done. Unfortunately, the documentation remains silent on this. My guess was based on a peek at some bug reports, looking up some common conventions and experimenting with a couple of graphs. – ilian Dec 11 '15 at 14:54

My best guess is that it's computing the cyclic clustering coefficient $C_i^{cyc}$, see page 13 and earlier of Fagiolo, G., 2007. Clustering in complex directed networks. Physical Review E, 76(2), p.026107 (arXiv link) for the definition.