public class TriangleEnumerator<K extends Comparable<K>,VV,EV> extends Object implements GraphAlgorithm<K,VV,EV,DataSet<Tuple3<K,K,K>>>
The basic algorithm works as follows: It groups all edges that share a common vertex and builds triads, i.e., triples of vertices that are connected by two edges. Finally, all triads are filtered for which no third edge exists that closes the triangle.
For a group of n edges that share a common vertex, the number of built triads is quadratic ((n*(n-1))/2). Therefore, an optimization of the algorithm is to group edges on the vertex with the smaller output degree to reduce the number of triads. This implementation extends the basic algorithm by computing output degrees of edge vertices and grouping on edges on the vertex with the smaller degree.
Modifier and Type | Class and Description |
---|---|
static class |
TriangleEnumerator.EdgeWithDegrees<K> |
static class |
TriangleEnumerator.Triad<K> |
Constructor and Description |
---|
TriangleEnumerator() |
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.