g <- graph(c(2,1,3,1,4,1,5,1,6,1,7,1),directed = F)
par(mfrow=c(2,3))
plot(g,vertex.size=40,layout=layout_on_grid,main="简单网络布局")
plot(g,vertex.size=40,layout=layout.auto,main="自动布局")
plot(g,vertex.size=40,layout=layout_as_star,main="星型布局")
plot(g,vertex.size=40,layout=layout.circle,main="环形布局")
plot(g,vertex.size=40,layout=layout_randomly,main="随机布局")
plot(g,vertex.size=40,layout=layout_as_tree(g),main="树状布局")
library(RColorBrewer)
weight<-seq(1,3,length.out = ecount(g))
V(g)$color <- brewer.pal(9,"Set1")[1:vcount(g)]#点的填充色
V(g)$frame.color <- NA# 点边框
V(g)$label.color <- "