24 Jan
2015
24 Jan
'15
10:11 a.m.
Hi, I'm wondering, why do the BFS and DFS algorithms not inspect the colour of the source vertices given to them? If a source vertex is already black, shouldn't the search effectively be a no-op? Currently the source vertex is 'discovered' and coloured grey regardless of its previous colour. I know it might seem weird to pass a black vertex as the source, but I guess I see it as similar to passing an empty range to an algorithm: it's valid but nothing happens. Thanks, cheers. Jeremy