fixed sub-network ranking and combined all output, going to fix the distance function