code: def _bidirectional_shortest_path(G, source, target, exclude):
      """Returns shortest path between source and target ignoring nodes in the
      container 'exclude'.
  
      Parameters
      ----------
  
      G : NetworkX graph
  
      source : node
          Starting node for path
  
      target : node
          Ending node for path
  
      exclude: container
          Container for nodes to exclude from the search for shortest paths
  
      Returns
      -------
      path: list
          Shortest path between source and target ignoring nodes in 'exclude'
  
      Raises
      ------
      NetworkXNoPath
          If there is no path or if nodes are adjacent and have only one path
          between them
  
      Notes
      -----
      This function and its helper are originally from
      networkx.algorithms.shortest_paths.unweighted and are modified to
      accept the extra parameter 'exclude', which is a container for nodes
      already used in other paths that should be ignored.
  
      References
      ----------
      .. [1] White, Douglas R., and Mark Newman. 2001 A Fast Algorithm for
          Node-Independent Paths. Santa Fe Institute Working Paper #01-07-035
          http://eclectic.ss.uci.edu/~drwhite/working.pdf
  
      """
      # call helper to do the real work
      results = _bidirectional_pred_succ(G, source, target, exclude)
      pred, succ, w = results
  
      # build path from pred+w+succ
      path = []
      # from source to w
      while w is not None:
          path.append(w)
          w = pred[w]
      path.reverse()
      # from w to target
      w = succ[path[-1]]
      while w is not None:
          path.append(w)
          w = succ[w]
  
      return path
  
file_path: networkx/networkx/algorithms/approximation/connectivity.py
imports: import itertools
  from operator import itemgetter
  import networkx
label_desc: Use image node_id 4 for calling a global function with example usage: _bidirectional_shortest_path(G, source, target, exclude) and returns: path