might be clearer if you iterate over edge types?