Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced Vector data structure by BitSet in greedy_color #379

Merged
merged 3 commits into from
May 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
gdalle marked this conversation as resolved.
Show resolved Hide resolved

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
Loading