我正在尝试创建一个3D晶格igraph
对象,其中节点连接到3D中的相邻和对角邻居(摩尔邻居)。我可以创建一个所有节点都连接到其冯诺依曼邻居(仅相邻节点)的对象,在3D中使用默认函数。
library(rgl)
library(igraph)
g <- make_lattice( c(4, 4, 4))
coords <- layout_with_fr(g, dim = 3)
rglplot(g, layout = coords)
现在我想让它的每一个节点都连接到它的对角邻居以及它的邻居。任何建议都将不胜感激...我相当卡住了。
如下所示(但适用于所有节点):
1条答案
按热度按时间vnzz0bqm1#
我认为这是可行的,虽然这是蛮力-几乎可以肯定有一种更优雅的方法来做到这一点,我不会在大型网格上尝试这种方法...
我认为布局算法把内部节点拉进比角多一点,因为它们有更多的连接...
(At有一点我写了一些很好的技巧来使用稀疏克罗内克积构造二维网格邻接矩阵-它们可能可以扩展到三维...)