Now I understand what you mean, you are comparing the full flags like
ìf edge.getFlags == edge2.getFlags. That is indeed suboptimal, but we should also not introduce yet another FlagEncoder method. Maybe we should introduce a customizable method for the Weighting like
boolean shouldCreateInstruction, but that is also not entire clear at this moment to me.
So I am not sure if we should change the current behavior.
Ok, so let us keep this for now and think about a 'weighting-based' instruction creation approach as well as moving this part out of the Path class.