Compute decayed power levels in a graph | Google Coding Question