The greedy strategy for optimizing the Perron eigenvalue