We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f26a6a commit 7149c41Copy full SHA for 7149c41
1 file changed
src/result.jl
@@ -467,8 +467,9 @@ For all vertex indices `i` we have:
467
remapped_color[i] = color_to_ind[color[i]]
468
"""
469
function remap_colors(color::Vector{Int})
470
- color_to_ind = Dict(c => i for (i, c) in enumerate(sort(unique(color[color .> 0]))))
471
- color_to_ind[0] = 0
+ sorted_colors = sort!(unique(color))
+ offset = sorted_colors[1] == 0 ? 1 : 0
472
+ color_to_ind = Dict(c => i - offset for (i, c) in enumerate(sorted_colors))
473
remapped_colors = [color_to_ind[c] for c in color]
474
return remapped_colors, color_to_ind
475
end
0 commit comments