DO NOT MERGE: avoid boxing when iterating edges in BFS