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 org.apache.spark.graphx.Graph#partitionBy.
Compute the number of triangles passing through each vertex.
The algorithm is relatively straightforward and can be computed in three steps:
Note that the input graph should have its edges in canonical direction (i.e. the
sourceId
less thandestId
). Also the graph must have been partitioned using org.apache.spark.graphx.Graph#partitionBy.