LiveRamp Interview Question

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