Skip to content

Commit 43f9f18

Browse files
AntoineButgdalle
andauthored
Replaced Vector data structure by BitSet in greedy_color (#379)
* Replaced Vector data structure by BitSet * Update src/traversals/greedy_color.jl * Update greedy_color.jl --------- Co-authored-by: Guillaume Dalle <[email protected]>
1 parent 615afe4 commit 43f9f18

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/traversals/greedy_color.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,18 @@ function perm_greedy_color(g::AbstractGraph, seq::Vector{T}) where {T<:Integer}
2323

2424
has_self_loops(g) && throw(ArgumentError("graph must not have self loops"))
2525

26+
colors_used = BitSet()
27+
2628
for v in seq
27-
colors_used = zeros(Bool, nvg)
29+
empty!(colors_used)
2830
for w in neighbors(g, v)
2931
if seen[w]
30-
colors_used[cols[w]] = true
32+
push!(colors_used, cols[w])
3133
end
3234
end
3335

3436
for i in one(T):nvg
35-
if colors_used[i] == false
37+
if i colors_used
3638
cols[v] = i
3739
break
3840
end

0 commit comments

Comments
 (0)