sub function in ctFIRE, modified from network_stat.m in FIRE