Путь NetworkX между двумя узлами
import networkx as nx
path = list(nx.shortest_path(G, source=0, target=1))
print(path)
Smoking Snake
import networkx as nx
path = list(nx.shortest_path(G, source=0, target=1))
print(path)