Or maybe this is due to modifying the graph while iterating through neighbors…
Edit: Yep, this is it, you can maybe store the edges you want to delete in each pass through a neighborhood, then delete all the edges at once.
2 Likes