How do I get the vertices on the shortest path using igraph?

后端 未结 3 744
北恋
北恋 2021-01-12 03:20

I\'m using igraph to generate a matrix of shortest path distances between pairs of vertices but I can\'t figure out how to return the vertices. So far I have:

3条回答
  •  迷失自我
    2021-01-12 04:12

    The function you need is get_shortest_paths I believe. See https://igraph.org/python/doc/igraph.GraphBase-class.html#get_shortest_paths

    You need to call it individually for each source vertex, and it will give you only a single (arbitrary) shortest path for each pair of nodes. If you need all shortest paths, then see get_all_shortest_paths: https://igraph.org/python/doc/igraph.GraphBase-class.html#get_all_shortest_paths

提交回复
热议问题