@@ -314,10 +314,10 @@ function _prevent_cycle!(
314314 forbidden_colors:: AbstractVector{<:Integer} ,
315315 forest:: Forest{<:Integer} ,
316316)
317- id = find_root! (forest, index_wx) # The edge wx belongs to the 2-colored tree T, represented by an edge with an integer ID
318- (p, q) = first_visit_to_tree[id ]
317+ 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
318+ (p, q) = first_visit_to_tree[root_wx ]
319319 if p != v # T is being visited from vertex v for the first time
320- first_visit_to_tree[id ] = (v, w)
320+ first_visit_to_tree[root_wx ] = (v, w)
321321 elseif q != w # T is connected to vertex v via at least two edges
322322 forbidden_colors[color[x]] = v
323323 end
@@ -339,9 +339,9 @@ function _grow_star!(
339339 if p != v # a neighbor of v with color[w] encountered for the first time
340340 first_neighbor[color[w]] = (v, w, index_vw)
341341 else # merge T_{vw} with a two-colored star being grown around v
342- root1 = find_root! (forest, index_vw)
343- root2 = find_root! (forest, index_pq)
344- root_union! (forest, root1, root2 )
342+ root_vw = find_root! (forest, index_vw)
343+ root_pq = find_root! (forest, index_pq)
344+ root_union! (forest, root_vw, root_pq )
345345 end
346346 return nothing
347347end
@@ -356,10 +356,10 @@ function _merge_trees!(
356356 # modified
357357 forest:: Forest{<:Integer} ,
358358)
359- root1 = find_root! (forest, index_vw)
360- root2 = find_root! (forest, index_wx)
361- if root1 != root2
362- root_union! (forest, root1, root2 )
359+ root_vw = find_root! (forest, index_vw)
360+ root_wx = find_root! (forest, index_wx)
361+ if root_vw != root_wx
362+ root_union! (forest, root_vw, root_wx )
363363 end
364364 return nothing
365365end
0 commit comments