Rate-Optimal Subspace Estimation on Random Graphs