Identifying an optimal set of nodes in a network