added R code to compute state similarity matrix & matlab code for modularity based clustering