modified filter function (iteration over edges in same direction)