Trying to find networking metrics with R -
i have created directed network in r. have find average degree, think have, diameter , maximum/minimum clustering. diameter longest of shortest distances between 2 nodes. if makes sense anyone, please point me in right direction. have have coded below far.
library(igraph) ghw <- graph.formula(1-+4:5:9:12:14, 2-+11:16:17, 3-+4:5:7, 4-+1:3:6:7:8, 5-+1:3:6:7, 6-+4:5:8, 7-+3:4:5:8:13, 8-+4:6:7, 9-+10:12:14:15, 10-+9:12:14, 11-+2:16:17, 12-+1:9:10:14, 13-+7:15:18, 14-+1:9:10:12, 15-+13:16:18, 16-+2:11:15:17:18, 17-+2:11:16:18, 18-+13:15:16:17) plot(ghw) get.adjacency(ghw)
total number of directed edges
numdeg <- ecount(ghw)
average number of edges per node
avgdeg <- numdeg / 18
how looking @ documentation?
diameter(ghw)
i not sure mean maximum/minimum clustering, maybe this:
range(transitivity(ghw, type="local"))
btw. average number of edges per node wrong, because every edge belongs 2 nodes.
Comments
Post a Comment