summaryrefslogtreecommitdiffstats
path: root/R Scripts/analyze-cascades.R
diff options
context:
space:
mode:
authorBen Green <bgreen@g.harvard.edu>2015-09-14 23:19:34 -0400
committerBen Green <bgreen@g.harvard.edu>2015-09-14 23:19:37 -0400
commit58faa01748fe0e6f6d040d1296266d17bd7a3543 (patch)
treeb1a2bf0709ec3d4c252d90c4dba8e42b3057c91b /R Scripts/analyze-cascades.R
parentab0b1f3cefedb35327a19ec1b6afd560bfdf802d (diff)
downloadcriminal_cascades-58faa01748fe0e6f6d040d1296266d17bd7a3543.tar.gz
prediction and plotting cascades
Diffstat (limited to 'R Scripts/analyze-cascades.R')
-rwxr-xr-xR Scripts/analyze-cascades.R7
1 files changed, 4 insertions, 3 deletions
diff --git a/R Scripts/analyze-cascades.R b/R Scripts/analyze-cascades.R
index 463de18..e758d60 100755
--- a/R Scripts/analyze-cascades.R
+++ b/R Scripts/analyze-cascades.R
@@ -21,7 +21,7 @@ order = rev(order(csize))
plot(sizes,counts,log='xy',type='o',lwd=3,
xlab='Size of Cascade', ylab='Number of Cascades', main='Distribution of Cascade Sizes')
-i = 14
+i = 4
V = which(clusters(dag)$membership==order[i]) # get all nodes in cluster
cc = induced.subgraph(dag,V)
Vi = vic_ids[V]
@@ -35,8 +35,9 @@ cols[seed] = 'red'
plot(cc,vertex.size=10,edge.arrow.size=0.5,vertex.color=cols,vertex.label.cex=1,
edge.width=E(cc)$weight*20/max(E(cc)$weight),layout=layout.reingold.tilford(cc,root=seed),
vertex.label=V(hyp_lcc)$vic.day[Vi])
-# vertex.label=as.Date(V(hyp_lcc)$vic.day[Vi], format ='%m/%d/%y'))
-# vertex.label=V(lcc)$vic_date[Vi])
+plot(cc,vertex.size=10,edge.arrow.size=0.5,vertex.color=cols,vertex.label.cex=1,
+ layout=layout.reingold.tilford(cc,root=seed))
+
### basic graph statistics
trl = mean(transitivity(cc,type='local',isolates='zero'))