Class Metrics
java.lang.Object
edu.uci.ics.jung.algorithms.metrics.Metrics
A class consisting of static methods for calculating graph metrics.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclusteringCoefficients
(Graph<V, E> graph) Returns aMap
of vertices to their clustering coefficients.
-
Constructor Details
-
Metrics
public Metrics()
-
-
Method Details
-
clusteringCoefficients
Returns aMap
of vertices to their clustering coefficients. The clustering coefficient cc(v) of a vertex v is defined as follows:degree(v) == {0,1}
: 0degree(v) == n, n >= 2
: given S, the set of neighbors ofv
: cc(v) = (the sum over all w in S of the number of other elements of w that are neighbors of w) / ((|S| * (|S| - 1) / 2). Less formally, the fraction ofv
's neighbors that are also neighbors of each other.
Note: This algorithm treats its argument as an undirected graph; edge direction is ignored.
- Type Parameters:
V
- the vertex typeE
- the edge type- Parameters:
graph
- the graph whose clustering coefficients are to be calculated- Returns:
- the clustering coefficient for each vertex
- See Also:
-