User Tools

Site Tools


r:social_network_analysis

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
r:social_network_analysis [2023/06/12 03:08] – [Hawthorne study] hkimscilr:social_network_analysis [2023/11/22 22:02] (current) – [Hawthorne study] hkimscil
Line 27: Line 27:
  
 <code> <code>
 +V(g)$type <- bipartite_mapping(g)$type
 types <- V(g)$type       types <- V(g)$type      
 deg <- degree(g) deg <- degree(g)
Line 178: Line 179:
  
 </code> </code>
 +===== stu x class 처럼 분석한 예 =====
  
 <code> <code>
 actor_matrix <- bipartite_matrix %*% t(bipartite_matrix) actor_matrix <- bipartite_matrix %*% t(bipartite_matrix)
 event_matrix <- t(bipartite_matrix) %*% bipartite_matrix event_matrix <- t(bipartite_matrix) %*% bipartite_matrix
 +
  
 diag(actor_matrix) <- 0 diag(actor_matrix) <- 0
 actor_matrix actor_matrix
 +actor_matrix_cff_2 <- ifelse(actor_matrix > 2, actor_matrix, 0) # cuttoff 3 below
 +actor_matrix_cff_3 <- ifelse(actor_matrix > 3, actor_matrix, 0) # cuttoff 3 below
  
 actor_g <- graph_from_adjacency_matrix(actor_matrix,  actor_g <- graph_from_adjacency_matrix(actor_matrix, 
                                        mode = "undirected",                                         mode = "undirected", 
                                        weighted = TRUE)                                        weighted = TRUE)
 +
 +actor_g_cff_2 <- graph_from_adjacency_matrix(actor_matrix_cff_2, 
 +                                             mode = "undirected", 
 +                                             weighted = TRUE)
 +actor_g_cff_3 <- graph_from_adjacency_matrix(actor_matrix_cff_3, 
 +                                             mode = "undirected", 
 +                                             weighted = TRUE)
 +
 +V(actor_g)$size <- betweenness(actor_g)
 +V(actor_g_cff_2)$size <- betweenness(actor_g_cff_2)
 +V(actor_g_cff_3)$size <- betweenness(actor_g_cff_3)
 +V(actor_g)$label.cex <- betweenness(actor_g) * 0.2
 +V(actor_g_cff_2)$label.cex <- betweenness(actor_g_cff_2) * 0.1
 +V(actor_g_cff_3)$label.cex <- betweenness(actor_g_cff_3) * 0.4
 +
 actor_g actor_g
 +actor_g_cff_2
 +actor_g_cff_3
  
 event_g <- graph_from_adjacency_matrix(event_matrix,  event_g <- graph_from_adjacency_matrix(event_matrix, 
Line 195: Line 217:
                                        weighted = TRUE)                                        weighted = TRUE)
 event_g event_g
- 
-# V(actor_g)$size <- degree(actor_g) 
-V(actor_g)$label.cex <- actor_g * 0.1 
- 
  
 windowsFonts(d2coding = windowsFont("D2Coding")) windowsFonts(d2coding = windowsFont("D2Coding"))
 windowsFonts(lucida = windowsFont("Lucida Console")) windowsFonts(lucida = windowsFont("Lucida Console"))
-windowsFonts(courrier = windowsFont("Courrier New")) 
  
 shape <- c("circle", "square") shape <- c("circle", "square")
 fnts <- c("d2coding", "lucida") fnts <- c("d2coding", "lucida")
  
-plot(actor_g, layout = layout_with_graphopt,+plot(actor_g,      
      vertex.shape= shape[as.numeric(V(g)$type) + 1],      vertex.shape= shape[as.numeric(V(g)$type) + 1],
-     vertex.label.family= fnts[as.numeric(V(g)$type)+1] +     vertex.label.family= fnts[as.numeric(V(g)$type)+1]
-+     edge.color="red", edge.width=3 
 +)  
 +plot(actor_g_cff_2, 
 +     vertex.shape= shape[as.numeric(V(g)$type) + 1], 
 +     vertex.label.family= fnts[as.numeric(V(g)$type)+1], 
 +     edge.color="red", edge.width=3 
 +)  
 +plot(actor_g_cff_3, 
 +     vertex.shape= shape[as.numeric(V(g)$type) + 1], 
 +     vertex.label.family= fnts[as.numeric(V(g)$type)+1], 
 +     edge.color="red", edge.width=3 
 +
 </code> </code>
-{{:r:pasted:20230612-025234.png}}+ 
 +[{{:r:pasted:20230612-081851.png|actor_g}}] \\ 
 +[{{:r:pasted:20230612-082040.png|actor_g_cff_2}}] \\ 
 +[{{:r:pasted:20230612-082055.png|actor_g_cff_3}}] 
 + 
 + 
 +===== 다른 방법 =====
  
 <code> <code>
r/social_network_analysis.1686506934.txt.gz · Last modified: 2023/06/12 03:08 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki