code: def _single_source_shortest_path_basic(G, s):
      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
      D[s] = 0
      Q = deque([s])
      while Q:  # use BFS to find shortest paths
          v = Q.popleft()
          S.append(v)
          Dv = D[v]
          sigmav = sigma[v]
          for w in G[v]:
              if w not in D:
                  Q.append(w)
                  D[w] = Dv + 1
              if D[w] == Dv + 1:  # this is a shortest path, count paths
                  sigma[w] += sigmav
                  P[w].append(v)  # predecessors
      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 3 for calling a global function with example usage: _single_source_shortest_path_basic(G, s) and returns: S,  P,  sigma,  D