code: def test_egonet_splitter():
      """
      Test the Ego Net splitter procedure.
      """
      graph = nx.newman_watts_strogatz_graph(100, 5, 0.3)
  
      model = EgoNetSplitter()
  
      model.fit(graph)
      memberships = model.get_memberships()
  
      indices = [k for k, v in memberships.items()].sort()
      nodes = [node for node in graph.nodes()].sort()
  
      assert graph.number_of_nodes() == len(memberships)
      assert indices == nodes
      assert type(memberships) == dict
  
      graph = nx.newman_watts_strogatz_graph(150, 5, 0.3)
  
      model = EgoNetSplitter()
  
      model.fit(graph)
      memberships = model.get_memberships()
  
      indices = [k for k, v in memberships.items()].sort()
      nodes = [node for node in graph.nodes()].sort()
  
      assert graph.number_of_nodes() == len(memberships)
      assert indices == nodes
      assert type(memberships) == dict
  
      # Test weighted graph
      graph = nx.les_miserables_graph()
      graph = nx.convert_node_labels_to_integers(graph)
      model = EgoNetSplitter(weight="weight")
      model.fit(graph)
      memberships = model.get_memberships()
  
      indices = [k for k, v in memberships.items()].sort()
      nodes = [node for node in graph.nodes()].sort()
  
      assert graph.number_of_nodes() == len(memberships)
      assert indices == nodes
      assert type(memberships) == dict
  
      # Force unweighted
      graph = nx.les_miserables_graph()
      graph = nx.convert_node_labels_to_integers(graph)
      model = EgoNetSplitter(weight=None)
      model.fit(graph)
      memberships = model.get_memberships()
  
      indices = [k for k, v in memberships.items()].sort()
      nodes = [node for node in graph.nodes()].sort()
  
      assert graph.number_of_nodes() == len(memberships)
      assert indices == nodes
      assert type(memberships) == dict
  
file_path: karateclub/test/community_detection_overlapping_test.py
imports: import numpy
  import networkx
  from karateclub.community_detection.overlapping import EgoNetSplitter, NNSED, DANMF, MNMF, BigClam, SymmNMF
label_desc: Use image node_id 1 for calling a global function with example usage: test_egonet_splitter() without return types