#無向グラフを作成する
e.matrix <- matrix(c(1,2,1,3,1,4,2,3),ncol =2 , byrow = TRUE)
e.matrix
[,1] [,2]
[1,] 1 2
[2,] 1 3
[3,] 1 4
[4,] 2 3
g4 <- graph.edgelist(e.matrix-1, directed = FALSE)
g4
Vertices: 4
Edges: 4
Directed: FALSE
Edges:
[0] 0 -- 1
[1] 0 -- 2
[2] 0 -- 3
[3] 1 -- 2
png("110214.g4.png")
plot(g4)
dev.off()