The second test sometimes passes, sometimes fails.
t.Errorf("should visit 5 vertices; visited %d", walks)
The stopping condition is
if v == 5 {
*stop = true
}
This means that if you reach vertex 5, then the walk should terminate. It's sure that we won't seen node 6 in this case, but there is no guarantee that we have already visited node 7. It depends on go's internal ordering of map keys.
The second test sometimes passes, sometimes fails.
t.Errorf("should visit 5 vertices; visited %d", walks)
The stopping condition is
This means that if you reach vertex 5, then the walk should terminate. It's sure that we won't seen node 6 in this case, but there is no guarantee that we have already visited node 7. It depends on go's internal ordering of map keys.