code: def get_shortest_path(M, start_node, end_node):
      # https://stackoverflow.com/a/53078901/1696420
      path = [end_node]
      k = end_node
      while M[start_node, k] != -9999:
          path.append(Pr[start_node, k])
          k = M[start_node, k]
      return path[::-1]
  
file_path: diffusion-for-beginners/soft_diffusion/graph_wasserstein.py
imports: from scipy.sparse import csr_matrix
  from scipy.sparse.csgraph import shortest_path
  from soft_diffusion.wasserstein import calculate_2_wasserstein_dist
  import torch
  import numpy
  import torchvision.transforms
  from torch.utils.data import DataLoader
  import torchvision
label_desc: Use image node_id 1 for calling a global function with example usage: get_shortest_path(M, start_node, end_node) and returns: path