I have been using Python and Networkx package in an attempt to detect bridges in a entity graph for a project. I am not familiar with generator objects in Python, and that is kind of my blocker at this point. My approach, since I have a large amount of disconnected nodes is to apply a bridge detection algorithm in the connected components of the graph instead of applying it in the entire graph.
The connected components function returns a generator object:
>>> conn = nx.connected_components(G)
>>> type(conn)
<type 'generator'>
I know I can iterate and get each component using:
>>> for component in conn:
>>> print component
but my issue is that I need to perform actions on each returned component such as edge removal and later on re-addition, BFS or DFS, and I am not sure how I could do that. When I try to iterate over each component nothing happens. Also I am not sure how can someone can iterate over each connected component's edges.
Any ideas?