I've looked for ways to count the no. of connected components online. I noticed that in most sites, the algorithm used is Depth-first search. I believe you can achieve the same thing Breadth-first search and union-find as well. So why do people prefer using DFS for finding number of connected components?