Class 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 result

    And 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

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String category()  
      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)  
      void compute0​(org.apache.hugegraph.computer.core.worker.ComputationContext context, org.apache.hugegraph.computer.core.graph.vertex.Vertex vertex)  
      void init​(org.apache.hugegraph.computer.core.config.Config config)  
      java.lang.String name()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.hugegraph.computer.core.worker.Computation

        afterSuperstep, beforeSuperstep, close
    • Constructor Detail

      • ClusteringCoefficient

        public ClusteringCoefficient()
    • Method Detail

      • name

        public java.lang.String name()
        Specified by:
        name in interface org.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>
        Overrides:
        name in class TriangleCount
      • category

        public java.lang.String category()
        Specified by:
        category in interface org.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>
        Overrides:
        category in class TriangleCount
      • 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:
        compute0 in interface org.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>
        Overrides:
        compute0 in class TriangleCount
      • 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:
        compute in interface org.apache.hugegraph.computer.core.worker.Computation<org.apache.hugegraph.computer.core.graph.value.IdList>
        Overrides:
        compute in class TriangleCount