Javascript code to calculate social network metrics from a 2d adjacency matrix.