public boolean findCircle(File f, Set<File> visitedFiles)
    {
        // terminating condition
        if(f.getNeighbors() == null || f.getNeighbors().isEmpty())
        {
            return false;
        }

        for(File neighbor : f.getNeighbors())
        {
            if(visitedFiles.contains(neighbor))
            {
                // visited this neighbor before, found circle!
                return true;
            }

            // add this neighbor to the usedFiles set
            visitedFiles.add(neighbor);
            // if going through the neighbors of this neighbor results in a circle, return true
            if(findCircle(neighbor, visitedFiles)) return true;

            // remove this neighbor, continue with next neighbor
            visitedFiles.remove(neighbor);
        }

        // if every neighbor does not result in a circle, return false
        return false;
    }