Skip to content

Commit

Permalink
Fix a bug when calling setComp(data, v, -1)
Browse files Browse the repository at this point in the history
  • Loading branch information
junkawahara committed Oct 4, 2024
1 parent 47bd0ac commit 9921ce0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/graphillion/degree_distribution/DegreeDistributionSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class DegreeDistributionSpec
static_cast<uchar>(fm_.vertexToPos(c));
}

void clearComp(DSData* data, int v) const {
assert(is_connected_);
data[fm_.vertexToPos(v) * 2 + 1] =
static_cast<uchar>(-1);
}

void incrementFixedDeg(DSData* data, int d) const {
++data[fixedDegStart_ + d];
}
Expand Down Expand Up @@ -285,7 +291,7 @@ class DegreeDistributionSpec
}
// Since comp of v are never used until the end,
// we erase the value.
setComp(data, v, -1);
clearComp(data, v);
}
// Since deg of v are never used until the end,
// we erase the value.
Expand Down
7 changes: 6 additions & 1 deletion src/graphillion/regular/RegularGraphs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class RegularSpec
static_cast<uchar>(fm_.vertexToPos(c));
}

void clearComp(RData* data, int v) const {
assert(is_connected_);
data[fm_.vertexToPos(v) * 2 + 1] = static_cast<uchar>(-1);
}

int getFixedDeg(RData* data) const {
return data[fixedDegStart_];
}
Expand Down Expand Up @@ -244,7 +249,7 @@ class RegularSpec
}
// Since comp of v are never used until the end,
// we erase the value.
setComp(data, v, -1);
clearComp(data, v);
}
// Since deg of v are never used until the end,
// we erase the value.
Expand Down

0 comments on commit 9921ce0

Please sign in to comment.