Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
无论如何要改变网络图中边的顺序,
在 R 中使用 igraph、visNetwork 甚至 JS 中的任何一个?
例如,我想要一个网络让所有的箭头都去,从和到;从所有的顺序,
但是在网上找不到任何东西来编辑边缘顺序的产生方式,
任何帮助表示赞赏?
使用igraph您可以将图形转换为数据框,然后arrange:
igraph
arrange
set.seed(4321) g <- igraph::sample_gnp(10, .4) %>% igraph::as.directed() df <- igraph::as_data_frame(g) dplyr::arrange(df, from)
这会给你类似的东西:
from to 1 1 4 2 1 5 3 1 6 4 1 7 5 1 8 6 1 10 7 2 4 8 2 8 9 2 9 10 2 10