class_docstr: Unit tests for the
  :func:`networkx.algorithms.community.centrality.girvan_newman`
  function.
code: def test_undirected(self):
      # Start with the graph .-.-.-.
      G = nx.path_graph(4)
      communities = list(nx.community.girvan_newman(G))
      assert len(communities) == 3
      # After one removal, we get the graph .-. .-.
      validate_communities(communities[0], [{0, 1}, {2, 3}])
      # After the next, we get the graph .-. . ., but there are two
      # symmetric possible versions.
      validate_possible_communities(
          communities[1], [{0}, {1}, {2, 3}], [{0, 1}, {2}, {3}]
      )
      # After the last removal, we always get the empty graph.
      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 2 for calling the TestGirvanNewman obj's underlying member method code with example usage: obj.test_undirected() without return types