networkit.globals

class networkit.globals.ClusteringCoefficient

Bases: object

Class, which provides static functions for computing additional information for clustering coefficients. A ClusteringCoefficient object itself doesn’t have to be created.

static approxAvgLocal(G, trials)

Approximates the average local clustering coefficient.

Parameters:
  • G (networkit.Graph) – The input graph.

  • trials (int) – Number of runs. Higher values result in higher quality and larger running times.

static approxGlobal(G, trials)

Approximates the global clustering coefficient.

Parameters:
  • G (networkit.Graph) – The input graph.

  • trials (int) – Number of runs. Higher values result in higher quality and larger running times.

static exactGlobal(G)

Calculates the global clustering coefficient.

Parameters:

G (networkit.Graph) – The input graph.

static sequentialAvgLocal(G)

This calculates the average local clustering coefficient of graph G using inherently sequential triangle counting.

Notes

\[c(G) := \frac{1}{n} \sum_{u \in V} c(u)\]

where

\[c(u) := \frac{2 \cdot |E(N(u))| }{\deg(u) \cdot ( \deg(u) - 1)}\]
Parameters:

G (networkit.Graph) – The input graph.

networkit.globals.clustering(G, error=0.01)

Returns approximate average local clustering coefficient. The maximum error can be given as a parameter and determines the number of samples taken.

For details see: Schank, Wagner: Approximating Clustering Coefficient and Transitivity

Parameters:
  • G (networkit.Graph) – The input graph.

  • error (float) – Maximum allowed error. Default: 0.01