Finding islands in a networkx graph

I am looking for a function within the networkx module which will list out all the islands in my graph. Having searched for a while, I can’t seem to find anything.

These are the islands which I am looking to list


Using nx.connected_components(), you can draw and print your desired “islands” as follows:

import networkx as nx
from matplotlib import pyplot as plt
G = nx.Graph()
for i, c in enumerate(nx.connected_components(G)):
    print(f"Island {i+1}: {c}")
nx.draw(G, with_labels=True)

Island 1: {1, 2, 3, 4}
Island 2: {8, 5, 6, 7}
Island 3: {9, 10, 11}

enter image description here