From b221a5d26788e679eb662e28c05fe0a8988cedb8 Mon Sep 17 00:00:00 2001 From: Alexis Montoison <35051714+amontoison@users.noreply.github.com> Date: Fri, 4 Apr 2025 22:19:23 -0500 Subject: [PATCH 1/2] Update coloring.jl --- src/coloring.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/coloring.jl b/src/coloring.jl index 5f14ece7..0be8879a 100644 --- a/src/coloring.jl +++ b/src/coloring.jl @@ -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 From a12c3128c8ce7064931249d67c9bd51af3d0b47b Mon Sep 17 00:00:00 2001 From: Alexis Montoison <35051714+amontoison@users.noreply.github.com> Date: Fri, 4 Apr 2025 23:31:57 -0500 Subject: [PATCH 2/2] Update coloring.jl --- src/coloring.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coloring.jl b/src/coloring.jl index 0be8879a..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