Skip to content
Merged
Changes from all commits
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
20 changes: 10 additions & 10 deletions src/coloring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,10 @@ function _prevent_cycle!(
forbidden_colors::AbstractVector{<:Integer},
forest::Forest{<:Integer},
)
id = find_root!(forest, index_wx) # The edge wx belongs to the 2-colored tree T, represented by an edge with an integer ID
(p, q) = first_visit_to_tree[id]
root_wx = find_root!(forest, index_wx) # The edge wx belongs to the 2-colored tree T, represented by an edge with an integer ID
(p, q) = first_visit_to_tree[root_wx]
if p != v # T is being visited from vertex v for the first time
first_visit_to_tree[id] = (v, w)
first_visit_to_tree[root_wx] = (v, w)
elseif q != w # T is connected to vertex v via at least two edges
forbidden_colors[color[x]] = v
end
Expand All @@ -339,9 +339,9 @@ function _grow_star!(
if p != v # a neighbor of v with color[w] encountered for the first time
first_neighbor[color[w]] = (v, w, index_vw)
else # merge T_{vw} with a two-colored star being grown around v
root1 = find_root!(forest, index_vw)
root2 = find_root!(forest, index_pq)
root_union!(forest, root1, root2)
root_vw = find_root!(forest, index_vw)
root_pq = find_root!(forest, index_pq)
root_union!(forest, root_vw, root_pq)
end
return nothing
end
Expand All @@ -356,10 +356,10 @@ function _merge_trees!(
# modified
forest::Forest{<:Integer},
)
root1 = find_root!(forest, index_vw)
root2 = find_root!(forest, index_wx)
if root1 != root2
root_union!(forest, root1, root2)
root_vw = find_root!(forest, index_vw)
root_wx = find_root!(forest, index_wx)
if root_vw != root_wx
root_union!(forest, root_vw, root_wx)
end
return nothing
end
Expand Down