diff --git a/src/coloring.jl b/src/coloring.jl index 5f14ece7..5c4f38a5 100644 --- a/src/coloring.jl +++ b/src/coloring.jl @@ -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 @@ -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 @@ -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