인류의 복지와 편익을 위한 인프라 건설을 주도하는토목공학과
제목
(2학년) 빅데이터마이닝 네트워크 분석 코딩 등(박영훈 교수)
작성일
2022.11.03
작성자
부천대학교 토목과
#646 install.packages("igraph") library(igraph) sn=read.csv("company_network.csv", header=T) head(sn, n=30) sn.df=graph.data.frame(sn,directed=FALSE) plot(sn.df) sn1=subset(sn, sn$V1==20) head(sn1) sn1=subset(sn, sn$V1==20) sn1.df=graph.data.frame(sn1, directed=FALSE) plot(sn1.df) vcount(sn.df) ecount(sn.df) V(sn.df)$name vmax=V(sn.df)$name[degree(sn.df)==max(degree(sn.df))] vmax degree(sn.df,vmax) sn1=subset(sn, sn$V2==5) sn1.df=graph.data.frame(sn1, directed=FALSE) plot(sn1.df) #vmin=V(sn.df)$name[degree(sn.df)==min(degree(sn.df))] #vmin #degree(sn.df,vmin) summary(degree(sn.df)) plot(degree(sn.df),ylim=c(0,15),xlab="?궗?슜?옄 踰덊샇", ylab="?뿰寃곗젙?룄",type='h') sn.df.dist=degree.distribution(sn.df) plot(sn.df.dist, xlab="?뿰寃곗젙?룄", ylab="?솗瑜?") sn.df.dist=degree.distribution(sn.df) degree(sn.df, normalized = TRUE) tmax=centralization.degree.tmax(sn.df) centralization.degree(sn.df, normalized=FALSE)$centralization/tmax sn.df.dist=degree.distribution(sn.df) closeness(sn.df, normalized = TRUE) tmax=centralization.closeness.tmax(sn.df) centralization.closeness(sn.df,normalized = FALSE)$centralization/tmax betweenness(sn.df, normalized=TRUE) graph.density(sn.df) average.path.length(sn.df) sn15=subset(sn,sn$V1<=15 & sn$V2<=15) sn15.graph=graph.data.frame(sn15, directed=FALSE) shortest.paths(sn15.graph) get.shortest.paths(sn15.graph, "5")