code: def _laplacian_dense(graph, normed=False, return_diag=False):
      n_nodes = graph.shape[0]
      lap = -np.asarray(graph)  # minus sign leads to a copy
  
      # set diagonal to zero
      lap.flat[:: n_nodes + 1] = 0
      w = -lap.sum(axis=0)
      if normed:
          w = np.sqrt(w)
          w_zeros = w == 0
          w[w_zeros] = 1
          lap /= w
          lap /= w[:, np.newaxis]
          lap.flat[:: n_nodes + 1] = (1 - w_zeros).astype(lap.dtype)
      else:
          lap.flat[:: n_nodes + 1] = w.astype(lap.dtype)
  
      if return_diag:
          return lap, w
      return lap
  
imports: import numpy
  from scipy import sparse
  from .validation import check_array
  from .graph_shortest_path import graph_shortest_path
label_desc: Use image node_id 4 for calling a global function with example usage: _laplacian_dense(graph, normed, return_diag) and returns: lap, lap,  w