code: def reconstruct_path(source, target, predecessors):
      """Reconstruct a path from source to target using the predecessors
      dict as returned by floyd_warshall_predecessor_and_distance
  
      Parameters
      ----------
      source : node
         Starting node for path
  
      target : node
         Ending node for path
  
      predecessors: dictionary
         Dictionary, keyed by source and target, of predecessors in the
         shortest path, as returned by floyd_warshall_predecessor_and_distance
  
      Returns
      -------
      path : list
         A list of nodes containing the shortest path from source to target
  
         If source and target are the same, an empty list is returned
  
      Notes
      -----
      This function is meant to give more applicability to the
      floyd_warshall_predecessor_and_distance function
  
      See Also
      --------
      floyd_warshall_predecessor_and_distance
      """
      if source == target:
          return []
      prev = predecessors[source]
      curr = prev[target]
      path = [target, curr]
      while curr != source:
          curr = prev[curr]
          path.append(curr)
      return list(reversed(path))
  
imports: import networkx
label_desc: Use image node_id 3 for calling a global function with example usage: reconstruct_path(source, target, predecessors) and returns: list, list