code: def _dok_gen_triples(A):
      """Converts a SciPy sparse array in **Dictionary of Keys** format to an
      iterable of weighted edge triples.
  
      """
      for (r, c), v in A.items():
          yield r, c, v
  
file_path: networkx/networkx/convert_matrix.py
imports: import itertools
  from collections import defaultdict
  import networkx
  from networkx.utils import not_implemented_for
label_desc: Use image node_id 9 for calling a global function with example usage: _dok_gen_triples(A) without return types