Pulsars
0 %
Log inSign up

BFS or DFS for this problem?

Open answer

You have the friendship graph of a social network (unweighted). You want to compute the degree of separation between two people, that is, the smallest number of intermediaries connecting one to the other.

Which traversal do you choose, BFS or DFS? Justify precisely.