Implement getEdges using iterator