You can use SciPy's shortest_path function for this purpose. Here's an example:
from scipy.sparse.csgraph import shortest_path
# Find the shortest path from node 0 to node 2
start_node = 0
end_node = 2
dist_matrix, predecessors = shortest_path(adj_matrix, directed=False, method='auto', return_predecessors=True)
path = []
while end_node != start_node:
path.append(end_node)
end_node = predecessors[start_node, end_node]
path.append(start_node)
path.reverse()
print("Shortest path:", path)