Question d’entretien chez LiveRamp

How would I implement the kevin bacon number problem using DFS instead of BFS?