code: def _prepare_line(edges, nodes):
      """Prepare a plotly scatter3d line plot \
      so that a set of disconnected edges \
      can be drawn as a single line.
  
      `edges` are values associated with each edge (that get mapped to colors
      through a colorscale). `nodes` are pairs of (source, target) node indices
      for each edge.
  
      the color of a line segment in plotly is a mixture of the colors associated
      with the points it connects. Moreover, segments that begin or end at a
      point whose value is `null` are not drawn.
  
      given edges = [eab, ecd, eef] and nodes = [(a, b), (c, d), (e, f)], this
      function returns:
  
          path_edges: eab eab   0 ecd ecd   0 eef eef   0
          path_nodes:   a   b   0   c   d   0   e   f   0
  
      moreover the javascript code replaces every third element (the '0' in the
      lists above) with `null`, so only the a-b, c-d, and e-f segments will get
      plotted, and their colors are correct because both their start and end
      points are associated with the same value.
      """
      path_edges = np.zeros(len(edges) * 3, dtype=int)
      path_edges[::3] = edges
      path_edges[1::3] = edges
      path_nodes = np.zeros(len(nodes) * 3, dtype=int)
      path_nodes[::3] = nodes[:, 0]
      path_nodes[1::3] = nodes[:, 1]
      return path_edges, path_nodes
  
file_path: nilearn/nilearn/plotting/html_connectome.py
imports: import json
  import numpy
  from matplotlib import cm
  from scipy import sparse
  from nilearn.plotting.html_document import HTMLDocument
  from ..None import datasets
  from .None import cm
  from .js_plotting_utils import add_js_lib, colorscale, encode, get_html_template, mesh_to_plotly, to_color_strings
label_desc: Use image node_id 2 for calling a global function with example usage: _prepare_line(edges, nodes) and returns: path_edges,  path_nodes