more optimizations; added DFS and Tarjan's algorithm to detect cut vertices

DFS and Tarjan's algorithm are currently unused because BFS turned out to be
faster