code: def _maximal_independent_set(G):
      """Returns a maximal independent set of nodes in ``G`` by repeatedly
      choosing an independent node of minimum degree (with respect to the
      subgraph of unchosen nodes).
  
      """
      result = set()
      remaining = set(G)
      while remaining:
          G = G.subgraph(remaining)
          v = min(remaining, key=G.degree)
          result.add(v)
          remaining -= set(G[v]) | {v}
      return result
  
imports: import itertools
  from collections import defaultdict, deque
  import networkx
  from networkx.utils import arbitrary_element, py_random_state
label_desc: Use image node_id 4 for calling a global function with example usage: _maximal_independent_set(G) and returns: result