'Return all Loop instances that can be extracted from a graph.
:param graph:   The graph to analyze.
:return:        A list of all the Loop instances that were found in the graph.'

def _parse_loops_from_graph(self, graph):

    outtop = []
    outall = []
    for subg in networkx.strongly_connected_component_subgraphs(graph):
        if (len(subg.nodes()) == 1):
            if (len(subg.successors(subg.nodes()[0])) == 0):
                continue
        (thisloop, allloops) = self._parse_loop_graph(subg, graph)
        if (thisloop is not None):
            outall += allloops
            outtop.append(thisloop)
    return (outtop, outall)
