![](/img/trans.png)
[英]How to get the a list of the edge attributes when performing shortest.paths in igraph (R)
[英]igraph in R: error with get.shortest.paths but not with shortest.paths
我曾經遇到過在使用R. IGRAPH奇怪的行為shortest.paths
命令返回正確的結果, get.shortest.paths
收益預警也沒有結果。
shortest.paths(g, v=2795, to=2839) # correct
[,1]
[1,] 3930.4
get.shortest.paths(g, from=2795, to=2839) # warning and no results
[[1]]
numeric(0)
Warning message:
In get.shortest.paths(g_novy, from = 2795, to = 2839) :
At structural_properties.c:5296 :Couldn't reach some vertices
有誰知道,問題是什么?
謝謝,Zbynek
我的猜測是你有一個有向圖。 shortest.paths
函數將告訴您最短的無向路徑的長度。 get.shortest.paths
函數告訴您頂點之間沒有有向路徑。 以下是似乎正在發生的事情的最簡單的例子:
g <- graph(1:2)
plot(g)
shortest.paths(g, v=2, to=1)
# [,1]
# [1,] 1
get.shortest.paths(g, from=2, to=1)
# [[1]]
# numeric(0)
#
# Warning message:
# In get.shortest.paths(g, from = 2, to = 1) :
# At structural_properties.c:706 :Couldn't reach some vertices
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.