Skip to content

Commit

Permalink
Merge pull request #209 from Ashok12011234/self_loop_bug
Browse files Browse the repository at this point in the history
Solve self loop counting cases in triangle counting
  • Loading branch information
miyurud authored Dec 12, 2023
2 parents d768f31 + b871eff commit e87ec7b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/query/algorithms/triangles/Triangles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ long Triangles::run(JasmineGraphHashMapLocalStore graphDB, JasmineGraphHashMapCe
std::set<long>::iterator nuListIterator;
for (nuListIterator = orderedNuList.begin(); nuListIterator != orderedNuList.end(); ++nuListIterator) {
long nu = *nuListIterator;
if ((localSubGraphMap[temp].find(nu) != localSubGraphMap[temp].end()) ||
(localSubGraphMap[nu].find(temp) != localSubGraphMap[nu].end())) {
if ( ((localSubGraphMap[temp].find(nu) != localSubGraphMap[temp].end()) ||
(localSubGraphMap[nu].find(temp) != localSubGraphMap[nu].end())) &&
(temp != nu) && (u != nu) && (temp != u) ) {
fullCount++;
std::vector<long> tempVector;
tempVector.push_back(temp);
Expand Down Expand Up @@ -231,8 +232,9 @@ string Triangles::countCentralStoreTriangles(map<long, unordered_set<long>> cent
std::unordered_set<long>::iterator nuListIterator;
for (nuListIterator = nuList.begin(); nuListIterator != nuList.end(); ++nuListIterator) {
long nu = *nuListIterator;
if ((centralStore[temp].find(nu) != centralStore[temp].end()) ||
(centralStore[nu].find(temp) != centralStore[nu].end())) {
if ( ((centralStore[temp].find(nu) != centralStore[temp].end()) ||
(centralStore[nu].find(temp) != centralStore[nu].end())) &&
(temp != nu) && (u != nu) && (temp != u) ) {
fullCount++;
std::vector<long> tempVector;
tempVector.push_back(temp);
Expand Down

0 comments on commit e87ec7b

Please sign in to comment.