org.apache.spark.graphx.lib
Class TriangleCount
Object
org.apache.spark.graphx.lib.TriangleCount
public class TriangleCount
- extends Object
Compute the number of triangles passing through each vertex.
The algorithm is relatively straightforward and can be computed in three steps:
- Compute the set of neighbors for each vertex
- For each edge compute the intersection of the sets and send the count to both vertices.
- Compute the sum at each vertex and divide by two since each triangle is counted twice.
Note that the input graph should have its edges in canonical direction
(i.e. the sourceId
less than destId
). Also the graph must have been partitioned
using Graph.partitionBy(org.apache.spark.graphx.PartitionStrategy)
.
Method Summary |
static
|
run(Graph<VD,ED> graph,
scala.reflect.ClassTag<VD> evidence$1,
scala.reflect.ClassTag<ED> evidence$2)
|
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TriangleCount
public TriangleCount()
run
public static <VD,ED> Graph<Object,ED> run(Graph<VD,ED> graph,
scala.reflect.ClassTag<VD> evidence$1,
scala.reflect.ClassTag<ED> evidence$2)