documentationfor yFiles for HTML 2.6

ClusteringCoefficient

Calculates the local clustering coefficient for each node and returns the average clustering coefficient.

Inheritance Hierarchy
ClusteringCoefficient

Remarks

The clustering coefficient measures the degree to which the nodes of a network tend to cluster together, see https://en.wikipedia.org/wiki/Clustering_coefficient. More precisely, for a node n, the local clustering coefficient is the actual number of edges between the neighbors of n divided by the maximum possible number of such edges. Hence, it is always a number value between 0.0 and 1.0.

Definitions

  • The local clustering coefficient of a node depends on the number of edges between its neighbors. A value of 1 indicates that the node's neighbors form a clique (i.e., there is an edge between each pair of neighbors).
  • Average clustering coefficient is the average of all the local clustering coefficient values of a graph.
  • Average weighted clustering coefficient is the average of all the local clustering coefficient values of a graph where each local value of a node is weighted by the maximum possible number of edges between its neighbors.

Examples

Calculating the clustering coefficient.
// prepare the algorithm
const algorithm = new ClusteringCoefficient({ directed: true })
// run the algorithm
const result = algorithm.run(graph)

// add the result as label
for (const node of graph.nodes) {
  graph.addLabel(node, String(result.clusteringCoefficients.get(node)))
}

Type Details

yfiles module
view-layout-bridge
yfiles-umd modules
view-layout-bridge
Legacy UMD name
yfiles.analysis.ClusteringCoefficient

See Also

The algorithm ignores self-loops and parallel edges. Group nodes are handled like common nodes.

Constructors

Properties

Methods