code: def build_k_number_dict(k_components):
      k_num = {}
      for k, comps in sorted(k_components.items()):
          for comp in comps:
              for node in comp:
                  k_num[node] = k
      return k_num
  
imports: import pytest
  import networkx
  from networkx.algorithms.approximation import k_components
  from networkx.algorithms.approximation.kcomponents import _AntiGraph, _same
label_desc: Use image node_id 1 for calling a global function with example usage: build_k_number_dict(k_components) and returns: k_num