clustering network from nodes