code: def normalized_laplacian_matrix(G, nodelist=None, weight="weight"):
      r"""Returns the normalized Laplacian matrix of G.
  
      The normalized graph Laplacian is the matrix
  
      .. math::
  
          N = D^{-1/2} L D^{-1/2}
  
      where `L` is the graph Laplacian and `D` is the diagonal matrix of
      node degrees [1]_.
  
      Parameters
      ----------
      G : graph
         A NetworkX graph
  
      nodelist : list, optional
         The rows and columns are ordered according to the nodes in nodelist.
         If nodelist is None, then the ordering is produced by G.nodes().
  
      weight : string or None, optional (default='weight')
         The edge data key used to compute each value in the matrix.
         If None, then each edge has weight 1.
  
      Returns
      -------
      N : SciPy sparse array
        The normalized Laplacian matrix of G.
  
      Notes
      -----
      For MultiGraph, the edges weights are summed.
      See :func:`to_numpy_array` for other options.
  
      If the Graph contains selfloops, D is defined as ``diag(sum(A, 1))``, where A is
      the adjacency matrix [2]_.
  
      This calculation uses the out-degree of the graph `G`. To use the
      in-degree for calculations instead, use `G.reverse(copy=False)` instead.
  
      For an unnormalized output, use `laplacian_matrix`.
  
      Examples
      --------
  
      >>> import numpy as np
      >>> np.set_printoptions(precision=4) # To print with lower precision
      >>> edges = [(1, 2), (2, 1), (2, 4), (4, 3), (3, 4),]
      >>> DiG = nx.DiGraph(edges)
      >>> print(nx.normalized_laplacian_matrix(DiG).toarray())
      [[ 1.     -0.7071  0.      0.    ]
       [-0.7071  1.     -0.7071  0.    ]
       [ 0.      0.      1.     -1.    ]
       [ 0.      0.     -1.      1.    ]]
      >>> G = nx.Graph(DiG)
      >>> print(nx.normalized_laplacian_matrix(G).toarray())
      [[ 1.     -0.7071  0.      0.    ]
       [-0.7071  1.     -0.5     0.    ]
       [ 0.     -0.5     1.     -0.7071]
       [ 0.      0.     -0.7071  1.    ]]
  
      See Also
      --------
      laplacian_matrix
      normalized_laplacian_spectrum
      directed_laplacian_matrix
      directed_combinatorial_laplacian_matrix
  
      References
      ----------
      .. [1] Fan Chung-Graham, Spectral Graph Theory,
         CBMS Regional Conference Series in Mathematics, Number 92, 1997.
      .. [2] Steve Butler, Interlacing For Weighted Graphs Using The Normalized
         Laplacian, Electronic Journal of Linear Algebra, Volume 16, pp. 90-98,
         March 2007.
      .. [3] Langville, Amy N., and Carl D. Meyer. Google’s PageRank and Beyond:
         The Science of Search Engine Rankings. Princeton University Press, 2006.
      """
      import numpy as np
      import scipy as sp
  
      if nodelist is None:
          nodelist = list(G)
      A = nx.to_scipy_sparse_array(
          G, nodelist=nodelist, weight=weight, format="csr"
      )
      n, m = A.shape
      diags = A.sum(axis=1)
      # TODO: rm csr_array wrapper when spdiags can produce arrays
      D = sp.sparse.csr_array(
          sp.sparse.spdiags(diags, 0, m, n, format="csr")
      )
      L = D - A
      with np.errstate(divide="ignore"):
          diags_sqrt = 1.0 / np.sqrt(diags)
      diags_sqrt[np.isinf(diags_sqrt)] = 0
      # TODO: rm csr_array wrapper when spdiags can produce arrays
      DH = sp.sparse.csr_array(
          sp.sparse.spdiags(diags_sqrt, 0, m, n, format="csr")
      )
      return DH @ (L @ DH)
  
file_path: networkx/networkx/linalg/laplacianmatrix.py
imports: import networkx
  from networkx.utils import not_implemented_for
label_desc: Use image node_id 2 for calling a global function with example usage: normalized_laplacian_matrix(G, nodelist, weight) and returns: unknown