class_docstr: Unit tests for the
  :func:`networkx.algorithms.community.centrality.girvan_newman`
  function.
code: def test_most_valuable_edge(self):
      G = nx.Graph()
      G.add_weighted_edges_from([(0, 1, 3), (1, 2, 2), (2, 3, 1)])
      # Let the most valuable edge be the one with the highest weight.
  
      def heaviest(G):
          return max(G.edges(data="weight"), key=itemgetter(2))[:2]
  
      communities = list(nx.community.girvan_newman(G, heaviest))
      assert len(communities) == 3
      validate_communities(communities[0], [{0}, {1, 2, 3}])
      validate_communities(communities[1], [{0}, {1}, {2, 3}])
      validate_communities(communities[2], [{0}, {1}, {2}, {3}])
  
file_path: networkx/networkx/algorithms/community/tests/test_centrality.py
imports: from operator import itemgetter
  import networkx
label_desc: Use image node_id 5 for calling the TestGirvanNewman obj's underlying member method code with example usage: obj.test_most_valuable_edge() and returns: max