User Tools

Site Tools


sna_eg_stanford:lab02

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
sna_eg_stanford:lab02 [2019/11/29 09:11] – created hkimscilsna_eg_stanford:lab02 [2019/11/29 09:33] hkimscil
Line 107: Line 107:
  for (i in 1:vcount(g)) {  for (i in 1:vcount(g)) {
  reach_mat[i,] = 0  reach_mat[i,] = 0
- this_node_reach <- subcomponent(g, (i - 1), mode = m)+ this_node_reach <- subcomponent(g, (i), mode = m)
  
  for (j in 1:(length(this_node_reach))) {  for (j in 1:(length(this_node_reach))) {
- alter = this_node_reach[j] + 1+ alter = this_node_reach[j]
  reach_mat[i, alter] = 1  reach_mat[i, alter] = 1
  }  }
Line 553: Line 553:
     #set probability of edge formation in random graph to proportion of possible edges present in original     #set probability of edge formation in random graph to proportion of possible edges present in original
     p.edge <- n.edges/(n.nodes*(n.nodes +1)/2)     p.edge <- n.edges/(n.nodes*(n.nodes +1)/2)
-    r.graph <- as.network.numeric(n.nodes, density = p.edge) +    r.graph <- as.network(n.nodes, density = p.edge) 
-    r.igraph <- as.igraph(r.graph)+    ## r.igraph <- as.igraph(r.graph) 
 +    r.igraph <- asIgraph(r.graph) 
 +    ##################################
     tc.graph <- triad.census(r.igraph)     tc.graph <- triad.census(r.igraph)
     clust <- sum(tc.graph*my.mask)     clust <- sum(tc.graph*my.mask)
sna_eg_stanford/lab02.txt · Last modified: 2019/12/11 08:52 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki