Python Networkx Find Closed Graphs