Skip to content

Commit d062ec1

Browse files
author
Laxman Dhulipala
committed
Fix a bug in the graph coloring implementation where we take log(0) if a node has zero degree.
1 parent 239a1db commit d062ec1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

benchmarks/GraphColoring/Hasenplaugh14/GraphColoring.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ inline sequence<uintE> Coloring(Graph& G, bool lf = false) {
117117
// LLF heuristic
118118
auto P = parlay::random_permutation<uintE>(n);
119119
parallel_for(0, n, 1, [&](size_t i) {
120-
uintE our_deg = parlay::log2_up(G.get_vertex(i).out_degree());
120+
uintE our_deg = parlay::log2_up(1 + G.get_vertex(i).out_degree());
121121
uintE i_p = P[i];
122122
// breaks ties using P
123123
auto count_f = [&](uintE src, uintE ngh, const W& wgh) {
124-
uintE ngh_deg = parlay::log2_up(G.get_vertex(ngh).out_degree());
124+
uintE ngh_deg = parlay::log2_up(1 + G.get_vertex(ngh).out_degree());
125125
return (ngh_deg > our_deg) || ((ngh_deg == our_deg) && P[ngh] < i_p);
126126
};
127127
priorities[i] = G.get_vertex(i).out_neighbors().count(count_f);

0 commit comments

Comments
 (0)