def DFS_loop(digr):
 node_explored = set([])
 finishing_times = []
 for node in digr.nodes():
  if (node not in node_explored):
   leader_node = node
   inner_DFS(digr, node, node_explored, finishing_times)
 return finishing_times

def DFS_loop ( digr ) : node_explored = set ( [ ] ) finishing_times = [ ] for node in digr . nodes ( ) : if ( node not in node_explored ) : leader_node = node inner_DFS ( digr , node , node_explored , finishing_times ) return finishing_times
core dfs loop used to find strongly connected components in a directed graph .