code: def test_greedy_modularity_communities_multigraph():
      G = nx.MultiGraph()
      G.add_edges_from(
          [
              (1, 2),
              (1, 2),
              (1, 3),
              (2, 3),
              (1, 4),
              (2, 4),
              (4, 5),
              (5, 6),
              (5, 7),
              (5, 7),
              (6, 7),
              (7, 8),
              (5, 8),
          ]
      )
      expected = [frozenset({1, 2, 3, 4}), frozenset({5, 6, 7, 8})]
      assert greedy_modularity_communities(G) == expected
  
      # Converting (4, 5) into a multi-edge causes node 4 to change group.
      G.add_edge(4, 5)
      expected = [frozenset({4, 5, 6, 7, 8}), frozenset({1, 2, 3})]
      assert greedy_modularity_communities(G) == expected
  
file_path: networkx/networkx/algorithms/community/tests/test_modularity_max.py
imports: import pytest
  import networkx
  from networkx.algorithms.community import greedy_modularity_communities, naive_greedy_modularity_communities
label_desc: Use image node_id 9 for calling a global function with example usage: test_greedy_modularity_communities_multigraph() without return types