({{, (RefLink[LocalClusteringCoefficient, paclet:ref/LocalClusteringCoefficient])[g] 
gives the list of local clustering coefficients of all vertices in the graph g.}, {, (RefLink[LocalClusteringCoefficient, paclet:ref/LocalClusteringCoefficient])[g,v]
gives the local clustering coefficient of the vertex v in the graph g.}, {, (RefLink[LocalClusteringCoefficient, paclet:ref/LocalClusteringCoefficient])[{v->w,…},…]
uses rules v->w to specify the graph g.}})

OpenersNotesSection(Spacer1)Details

(RefLink[LocalClusteringCoefficient, paclet:ref/LocalClusteringCoefficient]) is also known as clustering coefficient.

The local clustering coefficient of the vertex v is the fraction of pairs of neighbors of v that are connected over all pairs of neighbors of v.

(RefLink[LocalClusteringCoefficient, paclet:ref/LocalClusteringCoefficient]) works with undirected graphs, directed graphs, and multigraphs.

OpenersPrimaryExamplesSection(Spacer1)Examples  (14)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Compute local clustering coefficients:

g=ExampleData[{"NetworkGraph","Friendship"}];

LocalClusteringCoefficient[g]

Highlight:

HighlightGraph[g,VertexSize->Thread[VertexList[g]->%]]

Distribution of local clustering coefficients in a graph:

g=RandomGraph[BarabasiAlbertGraphDistribution[10000,50]];

Histogram[LocalClusteringCoefficient[g]]

OpenersExampleSection1(Spacer1)Scope  (6)

(RefLink[LocalClusteringCoefficient, paclet:ref/LocalClusteringCoefficient]) works with undirected graphs:

LocalClusteringCoefficient[]

Directed graphs:

LocalClusteringCoefficient[]

Multigraphs:

LocalClusteringCoefficient[]

Find the local clustering coefficient of a vertex:

LocalClusteringCoefficient[,1]

Use rules to specify the graph:

LocalClusteringCoefficient[{1->2,1->3,2->3,2->4,3->1,3->2,3->4}]

(RefLink[LocalClusteringCoefficient, paclet:ref/LocalClusteringCoefficient]) works with large graphs:

g=RandomGraph[WattsStrogatzGraphDistribution[10000,0.05,20]];

LocalClusteringCoefficient[g]//Short//Timing

OpenersExampleSection3(Spacer1)Applications  (2)

Local clustering coefficients of the internet at the level of autonomous systems:

g=ExampleData[{"NetworkGraph","Internet"}];

c=LocalClusteringCoefficient[g];
Histogram[c]

Plot the mean as a function of the vertex degree:

d=Union[VertexDegree[g]];

ListLogLogPlot[Table[{i,Mean[Pick[c,VertexDegree[g],i]]},{i,d}]]

Local clustering coefficients of Zachary's Karate Club:

g=ExampleData[{"NetworkGraph","ZacharyKarateClub"}]

c=LocalClusteringCoefficient[g]

Highlight vertices based on their local clustering coefficients:

HighlightGraph[g,Table[Style[VertexList[g][[i]],ColorData["TemperatureMap"][c[[i]]]],{i,VertexCount[g]}]]

OpenersExampleSection4(Spacer1)Properties & Relations  (4)

The local clustering coefficients take values between 0 and 1:

g=RandomGraph[BarabasiAlbertGraphDistribution[50,3]]

{Min[LocalClusteringCoefficient[g]], Max[LocalClusteringCoefficient[g]]}

The local clustering coefficient of a vertex with less than two neighbors is 0:

Graph[{1\[UndirectedEdge]2,2\[UndirectedEdge]3},VertexShapeFunction->"Name"]

LocalClusteringCoefficient[%,3]

All local clustering coefficients of a complete graph with at least three vertices are 1:

CompleteGraph[5]

LocalClusteringCoefficient[%]

(RefLink[MeanClusteringCoefficient, paclet:ref/MeanClusteringCoefficient]) gives the mean of (RefLink[LocalClusteringCoefficient, paclet:ref/LocalClusteringCoefficient]):

Graph[{1\[UndirectedEdge]2,1\[UndirectedEdge]3,2\[UndirectedEdge]3,2\[UndirectedEdge]4,3\[UndirectedEdge]4}]

{MeanClusteringCoefficient[%],Mean[LocalClusteringCoefficient[%]]}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[MeanClusteringCoefficient, paclet:ref/MeanClusteringCoefficient])  ▪  (RefLink[GlobalClusteringCoefficient, paclet:ref/GlobalClusteringCoefficient])  ▪  (RefLink[BetweennessCentrality, paclet:ref/BetweennessCentrality])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Social Network Analysis, paclet:guide/SocialNetworks])}, {▪(RefLinkPlain[Graph Measures & Metrics, paclet:guide/GraphMeasures])}, {▪(RefLinkPlain[Graph Properties & Measurements, paclet:guide/GraphPropertiesAndMeasurements])}})}})