我想在删除边缘后保持图形布局(顶点位置)。一个例子:
library(igraph)
library(ggraph)
# create sample graph
g <- structure(list(from = c(1, 1, 2, 2, 3, 3),
to = c(2, 3, 4, 5, 6, 7)),
class = "data.frame", row.names = c(NA, 6L))
g <- graph_from_data_frame(g)
# plot with all edges
ggraph(g, layout = 'tree') +
geom_edge_diagonal() +
geom_node_point(size = 10) +
theme_void()
现在删除几个边缘并重新绘制
g2 <- delete.edges(g, c(3,5))
ggraph(g2, layout = 'tree') +
geom_edge_diagonal() +
geom_node_point(size = 10) +
theme_void()
而这是所需的输出:
有没有一种简单的方法可以在去除边缘后保持顶点位置?