This python code uses a iterative deepening DFS to find a set....it's too complex to describe here