code: def test_modularity_communities_categorical_labels(func):
      # Using other than 0-starting contiguous integers as node-labels.
      G = nx.Graph(
          [
              ("a", "b"),
              ("a", "c"),
              ("b", "c"),
              ("b", "d"),  # inter-community edge
              ("d", "e"),
              ("d", "f"),
              ("d", "g"),
              ("f", "g"),
              ("d", "e"),
              ("f", "e"),
          ]
      )
      expected = {
          frozenset({"f", "g", "e", "d"}),
          frozenset({"a", "b", "c"}),
      }
      assert set(func(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 2 for calling a global function with example usage: test_modularity_communities_categorical_labels(func) without return types