我有一个大型空间显式 igraph 对象(2746 个节点/ 3205 个边),显示集水区中的沉积物输送路径。使用命令 all_simple_paths,我提取了从定义的源节点开始并最终在集水区出口的所有路径(使用 lapply)。all_simple_paths 的结果是 1841 个元素的列表,每个元素显示相应路径的顶点 ID。现在我正在努力绘制这些路径。我想在一张图像中以空间明确的方式绘制所有路径。就像到达出口的所有路径组成的图的一个子集。
“情节”给出了错误:
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' is a list, but does not have components 'x' and 'y'
我用“ggraph”绘制的完整图表,但对于“出口图表”,这个命令也给出了一个错误:
Error in create_layout.default(graph, layout, ...) :
No layout function defined for objects of class list
可能这很容易解决,但我已经尝试了各种可能性,并没有设法得到情节。
这里有一点(希望不要太简化)的例子:
`library(igraph)
a <- c(1,2,2,3,4,4,7,7,7)
b <- c(2,3,10,4,5,6,8,9,3)
c <- c("rf","se","se","ft","fd","ft","st", "st","st")
edges <- cbind(a,b,c)
id <- c(1,2,3,4,5,6,7,8,9,10)
x <- c(623096,622839,622475,622581,622480,622376,620313,621551,621142,622927)
y <- c(5149975,5150159,5150591,5151056,5151367,5151399,5150039,5150077,5150649,5150274)
nodes <- cbind(id,x,y)
my_graph <- graph_from_data_frame(edges, directed = TRUE,vertices = nodes)
plot(my_graph)
graph_outlet <- all_simple_paths(my_graph,from=1,to= 6,mode = "out")
plot (graph_outlet)`
非常感谢已经提前!