max edges counting stuff