User Tools

Site Tools


network_groups

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
network_groups [2015/12/01 08:49] hkimscilnetwork_groups [2015/12/02 14:31] (current) hkimscil
Line 1: Line 1:
 ====== Identifying groups of networks ====== ====== Identifying groups of networks ======
 +''setwd("D:/Users/Hyo/Cs-Kant/CS/Classes/sna_examples/sna_in_r")''
 +
 <code># Network's characteristics and subgroups <code># Network's characteristics and subgroups
 library(sna) library(sna)
Line 10: Line 12:
 gplot(fmh, vertex.cex=0.5, arrowhead.cex=0.5) gplot(fmh, vertex.cex=0.5, arrowhead.cex=0.5)
 </code> </code>
-{{fmh.png}}+{{fmh.png?400}}
  
 <code>round(gden(fmh),4) <code>round(gden(fmh),4)
Line 501: Line 503:
 </code> </code>
  
-str(fmh.clique$cliques) +위의 ''str(fmh.clique$cliques)'' 는\\  
-fmh.clique라는 데이터를 +fmh.clique 라는 데이터를 
 clique.census(fmh, . . . .)를 이용하여 생성하고 clique.census(fmh, . . . .)를 이용하여 생성하고
 거기서 발견되는 클리크(cliques)들을 나열해 본것.  거기서 발견되는 클리크(cliques)들을 나열해 본것. 
Line 513: Line 515:
  
 그 멤버들은 122, 183, 530, 1143, 1160 이다.  그 멤버들은 122, 183, 530, 1143, 1160 이다. 
- 
 Clique 정의에 따라서 이들은 maximal complete link (모두 연결되어 있는) 관계의 집단이다.  Clique 정의에 따라서 이들은 maximal complete link (모두 연결되어 있는) 관계의 집단이다. 
  
-<code>  ..$ :List of 15 +{{fmh.clique.5members.png?300}} 
-  .. ..$ : int [1:4] 240 767 1300 1401 + 
-  .. ..$ : int [1:4] 535 646 765 947 + 
-  .. ..$ : int [1:4] 535 646 724 765 +<code>s = matrix(0,5,5) 
-  .. ..$ : int [1:4] 290 836 1187 1335 +edge.list = matrix ( c(1,2,  1,3,  2,4 2,5,  3,4 3,5,  4,5,  5,4), byrow=T, ncol=2) 
-  .. ..$ : int [1:4] 251 688 1087 1419 +s[edge.list]=
-  .. ..$ : int [1:4] 487 729 749 991 +s 
-  .. ..$ : int [1:4] 487 492 729 991 +rownames(s)<-c("a", "b", "c", "d", "e"
-  .. ..$ : int [1:4] 122 1143 1160 1415 +colnames(s)<-c("a", "b", "c", "d", "e"
-  .. ..$ : int [1:4] 285 425 590 817 +> s
-  .. ..$ : int [1:4] 121 296 677 794 +
-  .. ..$ : int [1:4] 121 291 296 677 +
-  .. ..$ : int [1:4] 114 890 1061 1261 +
-  .. ..$ : int [1:4] 114 150 1061 1261 +
-  .. ..$ : int [1:4425 590 817 941 +
-  .. ..$ : int [1:4] 83 425 590 817 +
-  ..$ :List of 1 +
-  .. ..$ : int [1:5] 122 183 530 1143 1160+
 </code> </code>
 +<code>> s = matrix(0,5,5)
 +> edge.list = matrix ( c(1,2,  1,3,  2,4,  2,5,  3,4,  3,5,  4,5,  5,4), byrow=T, ncol=2)
 +> s[edge.list] = 1
 +> s
 +     [,1] [,2] [,3] [,4] [,5]
 +[1,]    0    1    1    0    0
 +[2,]    0    0    0    1    1
 +[3,]    0    0    0    1    1
 +[4,]    0    0    0    0    1
 +[5,]    0    0    0    1    0
 +</code>
 +
 +{{network_s.png?400}}
 +
 +눈으로 봐서 a를 중심으로 좌우동형이므로 b, c와 d,e는 각각 등치 (등가)라고 할 수 있다. 이를 수식으로 구하기 위한 접근 방법으로는 연결을 1, 비연결을 0으로 한 각 노드(점) 간의 거리를 구하여 거리가 가까운 것들을 모아 놓으면 될 것이다. 가장 흔한 예가 Hamming distance: 
 +  * see [[yt>P02mJhS9qQ4]]
 +
 +예:
 +
 +
 +<code>library(sna)
 +set.seed(123)
 +p1<-runif(10,0,1)
 +p2<-runif(10,0,1)
 +G1<-rgraph(10,tprob=sapply(p1,rep,10))
 +G2<-rgraph(10,tprob=t(sapply(p2,rep,10)))
 +G<-G1*G2
 +G
 +
 +hamming.G=sedist(G,method="hamming")
 +cluster <- equiv.clust(G, method="hamming", cluster.method="complete")
 +
 +
 +b.mdoel <- blockmodel(G, cluster, h=4.5)
 +b.model 
 +plot(b.model)
 +</code>
 +
 +{{cluster.dendrogram.png?400}}
 +
 +<code>> b.mdoel <- blockmodel(G, cluster, h=4.5)
 +> b.model 
 +
 +Network Blockmodel:
 +
 +Block membership:
 +
 +  2  3  4  5  6  7  8  9 10 
 +  2  1  3  4  1  1  3  4  5 
 +
 +Reduced form blockmodel:
 +
 +  
 +        Block 1 Block 2 Block 3 Block 4 Block 5
 +Block 1     0.0         0.875    0.25     0.5
 +Block 2     0.5     NaN   0.000    0.50     1.0
 +Block 3     0.0         0.500    0.25     0.5
 +Block 4     0.0         0.000    0.50     0.0
 +Block 5     0.0         1.000    1.00     NaN
 +> plot(b.model)
 +</code>
 +{{blockmodel.png?400}}
 +
network_groups.1448929151.txt.gz · Last modified: 2015/12/01 08:49 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki