library("igraph")
edgelist <- read.table("c:\\rdata\\edgelist.txt", header=T)
igraph <- graph.data.frame(edgelist, directed=TRUE)
tkplot(igraph, layout=layout.fruchterman.reingold)
metrics <- data.frame (
deg = degree(igraph),
bet = betweenness(igraph),
clo = closeness(igraph),
eig = evcent(igraph)$vector,
cor = graph.coreness(igraph)
)
res<-as.vector(lm(eig~bet,data=metrics)$residuals)
# install.packages("ggplot2")
library("ggplot2")
ggplot(
metrics,
aes(x=bet, y=eig,label=rownames(metrics),colour=res,size=abs(res))) +
xlab("Betweenness Centrality") +
ylab("Eigenvector Centrality") +
geom_text() +
ggtitle("Title text")
# actor <- rownames(metrics)
# metrics <- cbind(metrics, actor )
graph.density(igraph)
centralization.evcent(igraph, directed=TRUE)$centralization
centralization.degree(igraph)$centralization
centralization.closeness(igraph)$centralization
centralization.betweenness(igraph)$centralization