I am trying to find the shortest path in a graph from a source to a target as well as to find out the number of nodes visited.
(我试图找到图中从源到目标的最短路径,并找出访问的节点数。)
I can find the path using the networkx algorithms method. (我可以使用networkx算法方法找到路径。)
But it seems that I just get the path from source to target not the number of nodes visited in order to perform the search of the path. (但是似乎我只是获得从源到目标的路径,而不是为了执行路径搜索而访问的节点数。)
Any idea on how to do it? (有什么想法吗?)
nx.dijkstra_path(G, 0, 28)
ask by Zara translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…