@@ -57,7 +57,7 @@ class HugeGraphIntersectImpl implements RelationshipIntersect {
57
57
58
58
@ Override
59
59
public void intersectAll (long nodeIdA , IntersectionConsumer consumer ) {
60
- // skip high-degree nodes
60
+ // check the first node's degree
61
61
if (!degreeFilter .test (nodeIdA )) {
62
62
return ;
63
63
}
@@ -82,20 +82,21 @@ public void intersectAll(long nodeIdA, IntersectionConsumer consumer) {
82
82
83
83
long s ,t ;
84
84
85
+ // for all neighbours of A
85
86
while (mainDecompressingCursor .hasNextVLong ()) {
86
87
lastNodeC = -1 ;
87
- // again, skip high-degree nodes
88
+ // check the second node's degree
88
89
if (degreeFilter .test (nodeIdB )) {
89
90
decompressingCursorB = cursor (nodeIdB , decompressingCursorB , offsets , adjacency );
90
- // find first neighbour C of B with id > B
91
- CfromB = decompressingCursorB .skipUntil (nodeIdB );
91
+ // find first neighbour Cb of B with id > B
92
+ CfromB = decompressingCursorB .skipUntil (nodeIdB );// check the third node's degree
92
93
if (CfromB > nodeIdB && degreeFilter .test (CfromB )) {
93
94
// copy the state of A's cursor
94
95
decompressingCursorA .copyFrom (mainDecompressingCursor );
95
- // find the first neighbour C' of A with id >= C
96
+ // find the first neighbour Ca of A with id >= Cb
96
97
CfromA = decompressingCursorA .advance (CfromB );
97
98
98
- // if C' = C we have found a triangle
99
+ // if Ca = Cb we have found a triangle
99
100
// we only submit one triangle per parallel relationship
100
101
if (CfromA == CfromB && CfromB > lastNodeC ) {
101
102
consumer .accept (nodeIdA , nodeIdB , CfromB );
@@ -107,6 +108,7 @@ public void intersectAll(long nodeIdA, IntersectionConsumer consumer) {
107
108
follow = decompressingCursorA ;
108
109
t = CfromA ;
109
110
111
+ // while both A and B have more neighbours
110
112
while (lead .hasNextVLong () && follow .hasNextVLong ()) {
111
113
s = lead .nextVLong ();
112
114
if (s > t ) {
0 commit comments