/** * Get the local clustering coefficient score. This is computed as the * number of edges between neighbors, equal to the triangle count, * divided by the number of potential edges between neighbors. * * <p>A score of {@code Double.NaN} is returned for a vertex with degree 1 * for which both the triangle count and number of neighbors are zero. * * @return local clustering coefficient score */ public double getLocalClusteringCoefficientScore() { long degree = getDegree().getValue(); long neighborPairs = degree * (degree - 1) / 2; return (neighborPairs == 0) ? Double.NaN : getTriangleCount().getValue() / (double) neighborPairs; }
/** * Get the local clustering coefficient score. This is computed as the * number of edges between neighbors, equal to the triangle count, * divided by the number of potential edges between neighbors. * * <p>A score of {@code Double.NaN} is returned for a vertex with degree 1 * for which both the triangle count and number of neighbors are zero. * * @return local clustering coefficient score */ public double getLocalClusteringCoefficientScore() { long degree = getDegree().getValue(); long neighborPairs = degree * (degree - 1) / 2; return (neighborPairs == 0) ? Double.NaN : getTriangleCount().getValue() / (double) neighborPairs; }
/** * Get the local clustering coefficient score. This is computed as the * number of edges between neighbors, equal to the triangle count, * divided by the number of potential edges between neighbors. * * A score of {@code Double.NaN} is returned for a vertex with degree 1 * for which both the triangle count and number of neighbors are zero. * * @return local clustering coefficient score */ public double getLocalClusteringCoefficientScore() { long degree = getDegree().getValue(); long neighborPairs = degree * (degree - 1) / 2; return (neighborPairs == 0) ? Double.NaN : getTriangleCount().getValue() / (double)neighborPairs; }
/** * Format values into a human-readable string. * * @return verbose string */ public String toPrintableString() { return "Vertex ID: " + getVertexId0() + ", vertex degree: " + getDegree() + ", triangle count: " + getTriangleCount() + ", local clustering coefficient: " + getLocalClusteringCoefficientScore(); }
/** * Get the local clustering coefficient score. This is computed as the * number of edges between neighbors, equal to the triangle count, * divided by the number of potential edges between neighbors. * * <p>A score of {@code Double.NaN} is returned for a vertex with degree 1 * for which both the triangle count and number of neighbors are zero. * * @return local clustering coefficient score */ public double getLocalClusteringCoefficientScore() { long degree = getDegree().getValue(); long neighborPairs = degree * (degree - 1) / 2; return (neighborPairs == 0) ? Double.NaN : getTriangleCount().getValue() / (double) neighborPairs; }