假设我有一个如下定义的矩阵
M = [C1 C2 C3 C4]
Run Code Online (Sandbox Code Playgroud)
在C是列向量的情况下,我想要一些有效的(即没有用于循环)生成A向量的方法
ResultVec = [C1 C2;
C1 C3;
C1 C4;
C2 C3;
C2 C4;
C3 C4]
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我有一个大的igraph对象,它有几个边缘和顶点属性,我需要写入文件并稍后再次加载(可能通过不同的程序,如python).
> g
IGRAPH DN-- 85000 1000000 --
+ attr: name (v/c), numeric_var (e/n), binary_outcome1 (e/x), binary_outcome2 (e/x)
Run Code Online (Sandbox Code Playgroud)
那么我应该使用什么格式才能将所有边缘属性写入文件格式?
write.graph(g, file = "test1.fileextension",format = "which_format?")
Run Code Online (Sandbox Code Playgroud)
非常感谢!
我有一个缠绕在圆环上的晶格(图末尾的每个节点都链接到它们在网格上的相对节点)。
require("igraph")
require("rgl")
n = 10
g = graph.lattice(c(n,n)) # create a square lattice (nxn)
plot(g,vertex.size = 0.5,vertex.size = 4,vertex.label = NA,vertex.color = "red")
# want to connect up the corners (horribly done)
v1 = seq(from =1, to = n,by = 1)
v2 = seq(from = n, to = n^2, by = n)
v3 = seq(from = n^2, to = n^2 - n+1, by = -1)
v4 = seq(from = v3[length(v3)],to = 1,by = -n)
a = cbind(rbind(v1,v2), rbind(v3,v4))
a2 …Run Code Online (Sandbox Code Playgroud)