install.packages("igraph")

library(igraph)


gd <- graph(c(1,2, 2,3, 2,4, 1,4, 5,5, 3,6, 5,6))

plot(gd)


gu <- graph(c(1,2, 2,3, 2,4, 1,4, 5,5, 3,6), directed=FALSE) #directed=FALSE 화살표 방향 없애기

plot(gu, vertex.label=NA) #vertex.label=NA 숫자없애기


install.packages("gcookbook")

library(gcookbook)


g <- graph.data.frame(madmen2)

par(mar=c(0,0,0,0)) #margin 여백 0으로 설정

plot(g, layout=layout.fruchterman.reingold, 

     vertex.size=10, edge.arrow.size=0.5, vertex.label=NA)


#원으로 그리기

g <- graph.data.frame(madmen, directed=FALSE)

par(mar=c(0,0,0,0))

plot(g, layout=layout.circle, vertex.size=8, vertex.label=NA)

+ Recent posts