BUG: nx.connected_components returns generator in some versions of networkx