Make BFSForest independent from BFSTree.