I think that is precisely the kind of personalization that was intended for the argument: most_valuable_edge
The default value calls networkx.edge_betweenness_centrality() and returns the edge with the
largest centrality. So, you could write a function to do exactly that same calculation, but to also store the
edge in a list accessible to the function, but also to you outside of that function.
edges_removed = []
def recorded_most_valuable_edge(G)
betweenness = nx.edge_betweenness_centrality(G) max_edge = max(betweenness, key=betweenness.get)
edges_removed.append(max_edge)
return max_edge
comp = girvan_newman(G, most_valuable_edge=recorded_most_valuable_edge)
print(edges_removed)