Hi,
In order to make the example work as expected when rerouting the edges, you should do one of the following modifications in the CreateGroupPorts method:
1. You should set the Direction of the port to autocenter:
port.DirectionMode = BoundsPortDirectionMode.AutoCenter;
or
2. You should create a rotated bounds port instead of a dynamic port:
NRotatedBoundsPort port = new NRotatedBoundsPort(new NContentAlignment(ContentAlignment.TopCenter));