Graph 最短路径和Dijkstra算法的困难

Graph 最短路径和Dijkstra算法的困难,graph,graph-algorithm,igraph,shortest-path,Graph,Graph Algorithm,Igraph,Shortest Path,我试图借助于转移矩阵获得两个节点之间的所有最短路径矩阵不是对称的,因为图形不是有向的。我使用了以下代码: g <- graph.adjacency(DDGraph, weighted=TRUE, mode="directed") str(g) [1] 1-> 2 2-> 3 4-> 40 5-> 6 6->164 7-> 8 8-> 46 9-> 10 10->121 11->

我试图借助于转移矩阵获得两个节点之间的所有最短路径
矩阵不是对称的,因为图形不是有向的。我使用了以下代码:

g <- graph.adjacency(DDGraph, weighted=TRUE, mode="directed")
str(g)
      [1]   1->  2   2->  3   4-> 40   5->  6   6->164   7->  8   8-> 46   9-> 10  10->121  11-> 12  12-> 13  12->174  13-> 14  14->  1  15-> 18  16-> 17  18-> 16
s.paths <- shortest.paths(g, algorithm = "dijkstra")
G22->34->405->66->1647->88->469->1010->12111->1212->1312->17413->1414->1156->1718->16

s、 路径您尚未设置
最短路径
模式
参数,该参数用于告知igraph是否要考虑边缘方向。我认为<代码>模式=“ALL”<代码>是默认的,它不考虑边缘方向,因为它允许沿两个方向遍历边缘。请尝试使用
mode=“out”