Skip to content

Commit b94e069

Browse files
Mats-SXFlorentinD
andcommitted
Add more comments in the code
Co-authored-by: Florentin Dörre <[email protected]>
1 parent 10244e0 commit b94e069

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

core/src/main/java/org/neo4j/graphalgo/core/huge/HugeGraphIntersectImpl.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class HugeGraphIntersectImpl implements RelationshipIntersect {
5757

5858
@Override
5959
public void intersectAll(long nodeIdA, IntersectionConsumer consumer) {
60-
// skip high-degree nodes
60+
// check the first node's degree
6161
if (!degreeFilter.test(nodeIdA)) {
6262
return;
6363
}
@@ -82,20 +82,21 @@ public void intersectAll(long nodeIdA, IntersectionConsumer consumer) {
8282

8383
long s,t;
8484

85+
// for all neighbours of A
8586
while (mainDecompressingCursor.hasNextVLong()) {
8687
lastNodeC = -1;
87-
// again, skip high-degree nodes
88+
// check the second node's degree
8889
if (degreeFilter.test(nodeIdB)) {
8990
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
9293
if (CfromB > nodeIdB && degreeFilter.test(CfromB)) {
9394
// copy the state of A's cursor
9495
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
9697
CfromA = decompressingCursorA.advance(CfromB);
9798

98-
// if C' = C we have found a triangle
99+
// if Ca = Cb we have found a triangle
99100
// we only submit one triangle per parallel relationship
100101
if (CfromA == CfromB && CfromB > lastNodeC) {
101102
consumer.accept(nodeIdA, nodeIdB, CfromB);
@@ -107,6 +108,7 @@ public void intersectAll(long nodeIdA, IntersectionConsumer consumer) {
107108
follow = decompressingCursorA;
108109
t = CfromA;
109110

111+
// while both A and B have more neighbours
110112
while (lead.hasNextVLong() && follow.hasNextVLong()) {
111113
s = lead.nextVLong();
112114
if (s > t) {

0 commit comments

Comments
 (0)