Algorithm Visualizer DFS Implementation Error

I commented out your open_set_hash.remove(current). I don’t see why you remove the current from the visited list? Also moved the came_from[n] = current inside the if condition. This was to get the reconstruct_path function to work properly.

if n not in open_set_hash:
    came_from[n] = current

Looks like it works just fine after this. BTW. nice visualization you made!

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top