Finds all connected components of the graph.
    Returns a list of graph objects, each representing a connected component.
    Returns an empty list for an empty graph.

def get_connected_components_as_subgraphs(graph):
    """Finds all connected components of the graph.
    Returns a list of graph objects, each representing a connected component.
    Returns an empty list for an empty graph.
    """
    components = get_connected_components(graph)

    list_of_graphs = []

    for c in components:
        edge_ids = set()
        nodes = [graph.get_node(node) for node in c]
        for n in nodes:
            # --Loop through the edges in each node, to determine if it should be included
            for e in n['edges']:
                # --Only add the edge to the subgraph if both ends are in the subgraph
                edge = graph.get_edge(e)
                a, b = edge['vertices']
                if a in c and b in c:
                    edge_ids.add(e)
        # --Build the subgraph and add it to the list
        list_of_edges = list(edge_ids)
        subgraph = make_subgraph(graph, c, list_of_edges)
        list_of_graphs.append(subgraph)

    return list_of_graphs