User Tools

Site Tools


centrality

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
centrality [2015/11/24 09:29] hkimscilcentrality [2018/06/07 10:05] hkimscil
Line 4: Line 4:
  
 ===== Closeness ===== ===== Closeness =====
 +<code>setwd("D:/Users/Hyo/Cs-Kant/CS/Classes/sna_examples/sna_in_r")</code>
 <code># Social Network Analysis: Closeness Centrality   <code># Social Network Analysis: Closeness Centrality  
 library(sna) library(sna)
Line 19: Line 20:
 </code> </code>
  
-<code>gplot(L, displaylabels = T, vertex.cex = 1, label.cex = 2, edge.col="red",  +<code>gplot(L, displaylabels = T, vertex.cex = 1, label.cex = 2, edge.col="blue",  
-             boxed.labels = F, arrowhead.cex = 1, mode = "kamadakawai")+boxed.labels = F, arrowhead.cex = 1, mode = "kamadakawai")
 </code> </code>
 {{centrality_suzuki.png}} {{centrality_suzuki.png}}
Line 93: Line 94:
 </code> </code>
  
-</code>betweenness(L)+<code>betweenness(L)
 </code> </code>
 <code>[1]  0  0  0 36 32 30 24 14  0 <code>[1]  0  0  0 36 32 30 24 14  0
Line 117: Line 118:
 </code> </code>
 <code>[1] 56  0  0  0  0  0  0  0  0 <code>[1] 56  0  0  0  0  0  0  0  0
 +</code>
 +
 +<code># Two stars network
 +twostars <- matrix(0,13,13)
 +edges <- matrix(c(1,2,1,3,1,4,1,5,1,6,
 +                  6,7,7,8,8,13,9,13,10,13,11,13,12,13),
 +                  byrow=T,ncol=2)
 +twostars[edges] <- 1
 +twostars <- twostars + t(twostars) - twostars * t(twostars)
 +
 +gplot(twostars, displaylabels=T, vertex.cex=1, label.cex=1, 
 +      edge.col="red", boxed.labels=F, arrowhead.cex=1, mode="kamadakawai")
 +betweenness(twostars)
 +closeness(twostars)
 +</code>
 +{{two_star_network.png}}
 +
 +<code>>> betweenness(twostars)
 + [1] 76  0  0  0  0 70 72 70  0  0  0  0 76
 +> round(closeness(twostars),2)
 + [1] 0.35 0.27 0.27 0.27 0.27 0.39 0.40 0.39 0.27 0.27 0.27 0.27 0.35
 +</code>
 +
 +===== Eigenvector =====
 +__Eigenvector Centrality__
 +  * 중요한 노드에 연결된 노드가 중요하다는 관점
 +
 +<code>rownames(knoke.infor)
 +</code>
 +
 +<code>> rownames(knoke.infor) 
 + [1] "COUN" "COMM" "EDUC" "INDU" "MAYR" "WRO"  "NEWS" "UWAY" "WELF" "WEST"
 +</code>
 +
 +<code>round(evcent(knoke.infor),2)
 +</code>
 +
 +<code>> round(evcent(knoke.infor),2)
 + [1] 0.25 0.41 0.36 0.26 0.47 0.15 0.22 0.35 0.21 0.33
 +</code>
 +
 +<code>round(evcent(t(knoke.infor)),2)
 +</code>
 +
 +<code>> round(evcent(t(knoke.infor)),2)
 + [1] 0.30 0.45 0.21 0.34 0.45 0.04 0.46 0.18 0.28 0.13
 </code> </code>
  
  
centrality.txt · Last modified: 2019/11/12 16:04 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki