I created a graph G and add two nodes. Then I find the connected components of this graph and assign it to variable a.
import networkx as nx
G = nx.Graph()
G.add_node('a')
G.add_node('b')
a = nx.connected_components(G)
Then I print the variable a out:
>> print(list(a))
and I get the result as:
[set(['a']), set(['b'])]
After this, I print a again using the same prompt, but got nothing:
[]
I'm very curious about this. I print the connected components out once, and it seems that they disappeared?! Why?!