Class ClusteringCoefficient
- java.lang.Object
-
- org.apache.hugegraph.computer.algorithm.community.trianglecount.TriangleCount
-
- org.apache.hugegraph.computer.algorithm.community.cc.ClusteringCoefficient
-
- All Implemented Interfaces:
org.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>
public class ClusteringCoefficient extends TriangleCount
ClusteringCoefficient(CC) algorithm could calculate local & the whole graph: 1. local cc: get triangles & degree for current vertex, calculate them 2. whole cc have 2 ways to get the result: (NOT SUPPORTED NOW) - sum all open & closed triangles in graph, and calculate the result - sum all local cc for each vertex, and use avg as the whole graph resultAnd we have 2 ways to count local cc: 1. if we already saved the triangles in each vertex, we can calculate only in superstep0/compute0 to get the result
The formula of local CC is: C(v) = 2T / Dv(Dv - 1) v represents one vertex, T represents the triangles of current vertex, D represents the degree of current vertex
-
-
Constructor Summary
Constructors Constructor Description ClusteringCoefficient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringcategory()voidcompute(org.apache.hugegraph.computer.core.worker.ComputationContext context, org.apache.hugegraph.computer.core.graph.vertex.Vertex vertex, java.util.Iterator<org.apache.hugegraph.computer.core.graph.value.IdList> messages)voidcompute0(org.apache.hugegraph.computer.core.worker.ComputationContext context, org.apache.hugegraph.computer.core.graph.vertex.Vertex vertex)voidinit(org.apache.hugegraph.computer.core.config.Config config)java.lang.Stringname()-
Methods inherited from class org.apache.hugegraph.computer.algorithm.community.trianglecount.TriangleCount
triangleCount
-
-
-
-
Method Detail
-
name
public java.lang.String name()
- Specified by:
namein interfaceorg.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>- Overrides:
namein classTriangleCount
-
category
public java.lang.String category()
- Specified by:
categoryin interfaceorg.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>- Overrides:
categoryin classTriangleCount
-
init
public void init(org.apache.hugegraph.computer.core.config.Config config)
-
compute0
public void compute0(org.apache.hugegraph.computer.core.worker.ComputationContext context, org.apache.hugegraph.computer.core.graph.vertex.Vertex vertex)- Specified by:
compute0in interfaceorg.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>- Overrides:
compute0in classTriangleCount
-
compute
public void compute(org.apache.hugegraph.computer.core.worker.ComputationContext context, org.apache.hugegraph.computer.core.graph.vertex.Vertex vertex, java.util.Iterator<org.apache.hugegraph.computer.core.graph.value.IdList> messages)- Specified by:
computein interfaceorg.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>- Overrides:
computein classTriangleCount
-
-