Fix max edge calculation for n vertices