igraph(SNA)

트위터 단어 빈도수를 이용한 SNA
term.freq<-sort(rowSums(my.TDM.m), decrease=T)
my.Term<-my.TDM.m[rownames(my.TDM.m) %in% names(term.freq[term.freq>20]), ]
termMarix<-my.Term %*% t(my.Term)
igraph
g<-graph.adjacency(termMatrix, weight=T, mode='undirected')
g<-simplify(g)
V(g)$label<-V(g)$name
V(g)$degree<-degree(g)
layout1<-layout.fruchterman.reingold(g)
V(g)$label.cex<-2.2*V(g)$degree/max(V(g)$degree)+0.2
V(g)$label.color<-rgb(0, 0, 0.2, 0.8)
V(g)$frame.color<-NA
egam<-(log(E(g)$weight)+0.4)/max(log(E(g)$weight)+0.4)
E(g)$width<-egam
E(g)$color<-rgb(0.5, 0.5, 0, egam)
plot(g, layout=layout1)
twitte 팔로우 숫자 가져오는 스크립트
V(g)$follewers<-0
for(usr in V(g)){
tuser<-getUser(V(g)$name[usr+1])
print(paste('Getting info on', screenName(tuser)))
V(g)$followers[usr+1]<-followersCount(tuser)
followers.list<-getUser(V(g)$name[usr+1])$getFollowers()
for(tflwr in followers.list){
if(screenName(tflwr) %in% V(g)$name)
g<-add.edges(g, c(as.vector(V(g)[name==screenName(tflwr)]), usr))
}
print('Sleeping 10 min...')
Sys.sleep(600)