Contents

1 edgelist.txt
2 R Source
3 key actors
4 谿瑚襭


1 edgelist.txt #

source	target
2	6
3	6
3	17
4	7
5	7
6	5
7	19
7	23
7	22
8	23
8	12
9	24
9	4
10	6
10	23
11	14
12	17
12	13
12	20
13	3
14	18
14	2
15	21
16	11
16	22
17	11
18	19
19	18
19	24
19	2
19	21
19	25
20	1
20	10
21	19
22	8
22	19
23	9
24	18
24	23
25	7
25	8
25	19
27	26
27	6
26	20
26	6
26	19
26	27

2 R Source #

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

3 key actors #

  • degree(number of connections)
  • betweenness(number of shortest paths an actor is on)
  • closeness(relative distance to all other actors)
  • eigenvector centrality(leading eigenvector of sociomatrix)

4 谿瑚襭 #