code: def _kamada_kawai_solve(dist_mtx, pos_arr, dim):
      # Anneal node locations based on the Kamada-Kawai cost-function,
      # using the supplied matrix of preferred inter-node distances,
      # and starting locations.
  
      import numpy as np
      import scipy as sp
  
      meanwt = 1e-3
      costargs = (
          np,
          1 / (dist_mtx + np.eye(dist_mtx.shape[0]) * 1e-3),
          meanwt,
          dim,
      )
  
      optresult = sp.optimize.minimize(
          _kamada_kawai_costfn,
          pos_arr.ravel(),
          method="L-BFGS-B",
          args=costargs,
          jac=True,
      )
  
      return optresult.x.reshape((-1, dim))
  
imports: import networkx
  from networkx.utils import np_random_state
label_desc: Use image node_id 10 for calling a global function with example usage: _kamada_kawai_solve(dist_mtx, pos_arr, dim) and returns: optresult