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

Remove superfluous :GRAY assignment in depth first visit #66

Closed
monora opened this issue Oct 14, 2022 Discussed in #65 · 0 comments · Fixed by #68
Closed

Remove superfluous :GRAY assignment in depth first visit #66

monora opened this issue Oct 14, 2022 Discussed in #65 · 0 comments · Fixed by #68
Assignees

Comments

@monora
Copy link
Owner

monora commented Oct 14, 2022

Discussed in #65

Originally posted by delphaber October 12, 2022
Isn't line 200 superfluous? We are already marking the vertex as :GRAY in line 192 when we go deeper in the recursion level at line 201.

Just wondering if I'm missing something :)

rgl/lib/rgl/traversal.rb

Lines 191 to 201 in 3cdf5c2

def depth_first_visit(u, vis = DFSVisitor.new(self), &b)
vis.color_map[u] = :GRAY
vis.handle_examine_vertex(u)
each_adjacent(u) do |v|
vis.handle_examine_edge(u, v)
if vis.follow_edge?(u, v) # (u,v) is a tree edge
vis.handle_tree_edge(u, v) # also discovers v
vis.color_map[v] = :GRAY # color of v was :WHITE
depth_first_visit(v, vis, &b)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant