code: def _single_source_dijkstra_path_basic(G, s, weight):
      weight = _weight_function(G, weight)
      # modified from Eppstein
      S = []
      P = {}
      for v in G:
          P[v] = []
      sigma = dict.fromkeys(G, 0.0)  # sigma[v]=0 for v in G
      D = {}
      sigma[s] = 1.0
      push = heappush
      pop = heappop
      seen = {s: 0}
      c = count()
      Q = []  # use Q as heap with (distance,node id) tuples
      push(Q, (0, next(c), s, s))
      while Q:
          (dist, _, pred, v) = pop(Q)
          if v in D:
              continue  # already searched this node.
          sigma[v] += sigma[pred]  # count paths
          S.append(v)
          D[v] = dist
          for w, edgedata in G[v].items():
              vw_dist = dist + weight(v, w, edgedata)
              if w not in D and (w not in seen or vw_dist < seen[w]):
                  seen[w] = vw_dist
                  push(Q, (vw_dist, next(c), v, w))
                  sigma[w] = 0.0
                  P[w] = [v]
              elif vw_dist == seen[w]:  # handle equal paths
                  sigma[w] += sigma[v]
                  P[w].append(v)
      return S, P, sigma, D
  
file_path: networkx/networkx/algorithms/centrality/betweenness.py
imports: from collections import deque
  from heapq import heappop, heappush
  from itertools import count
  import networkx
  from networkx.algorithms.shortest_paths.weighted import _weight_function
  from networkx.utils import py_random_state
  from networkx.utils.decorators import not_implemented_for
label_desc: Use image node_id 4 for calling a global function with example usage: _single_source_dijkstra_path_basic(G, s, weight) and returns: S,  P,  sigma,  D