Skip to content

Commit

Permalink
Replaced Vector data structure by BitSet in greedy_color (#379)
Browse files Browse the repository at this point in the history
* Replaced Vector data structure by BitSet

* Update src/traversals/greedy_color.jl

* Update greedy_color.jl

---------

Co-authored-by: Guillaume Dalle <[email protected]>
  • Loading branch information
AntoineBut and gdalle authored May 28, 2024
1 parent 615afe4 commit 43f9f18
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/traversals/greedy_color.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ function perm_greedy_color(g::AbstractGraph, seq::Vector{T}) where {T<:Integer}

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

colors_used = BitSet()

for v in seq
colors_used = zeros(Bool, nvg)
empty!(colors_used)
for w in neighbors(g, v)
if seen[w]
colors_used[cols[w]] = true
push!(colors_used, cols[w])
end
end

for i in one(T):nvg
if colors_used[i] == false
if i colors_used
cols[v] = i
break
end
Expand Down

0 comments on commit 43f9f18

Please sign in to comment.