The networkx package was updated to return a generator from connected_component_subgraphs. This caused len() to fail. Updated code to reflect this.