You can use the code below as a starting point, call it after applying tree or flowchart layout and it will arrange links like this :

Some improvements you could make is to apply alternative paths to right-most nodes on a level (right->up->left instead of down>right->up->left), and distribute the links to a destination node based on the node's total number of incoming links.
void ArrangeBackLinks(FlowchartLayout layout)
{
Dictionary<int, List<DiagramNode>> levels = GetNodesByLevel(layout);
foreach (List<DiagramNode> level in levels.Values)
{
RectangleF levelBounds = LevelBounds(level);
foreach (DiagramNode node in level)
foreach (DiagramLink link in node.OutgoingLinks)
{
if (link.Origin.Bounds.Y > link.Destination.Bounds.Y)
{
float x = GetTopCenter(link.Origin).X - levelBounds.Left;
SetLoopPath(link, levelBounds.Right, x / levelBounds.Width, layout);
}
}
}
}
void SetLoopPath(DiagramLink link, float x, float offset, FlowchartLayout layout)
{
PointF origin = GetBottomCenter(link.Origin);
PointF dest = GetRightCenter(link.Destination);
float availableSpace = Math.Min(layout.NodeDistance, link.Destination.Bounds.Height);
offset *= availableSpace;
float top = GetTopCenter(link.Destination).Y + offset;
float right = x + availableSpace - offset + layout.LinkPadding;
float bottom = origin.Y + availableSpace - offset;
PointCollection points = link.ControlPoints;
points.Clear();
points.Add(origin);
points.Add(new PointF(origin.X, bottom));
points.Add(new PointF(right, bottom));
points.Add(new PointF(right, top));
points.Add(new PointF(dest.X, top));
link.UpdateFromPoints(false, true);
}
Dictionary<int, List<DiagramNode>> GetNodesByLevel(FlowchartLayout layout)
{
Dictionary<int, List<DiagramNode>> levels = new Dictionary<int, List<DiagramNode>>();
foreach (DiagramNode node in diagram.Nodes)
{
int level = (int)GetRightCenter(node).Y / (int)layout.NodeDistance;
if (!levels.ContainsKey(level))
levels[level] = new List<DiagramNode>();
levels[level].Add(node);
}
return levels;
}
RectangleF LevelBounds(List<DiagramNode> level)
{
RectangleF bounds = level[0].Bounds;
foreach (DiagramNode node in level)
bounds = RectangleF.Union(bounds, node.Bounds);
return bounds;
}
private PointF GetLeftCenter(DiagramNode node)
{
RectangleF r = node.Bounds;
return new PointF(r.Left, r.Top + r.Height / 2);
}
private PointF GetRightCenter(DiagramNode node)
{
RectangleF r = node.Bounds;
return new PointF(r.Right, r.Top + r.Height / 2);
}
private PointF GetBottomCenter(DiagramNode node)
{
RectangleF r = node.Bounds;
return new PointF(r.Left + r.Width / 2, r.Bottom);
}
private PointF GetTopCenter(DiagramNode node)
{
RectangleF r = node.Bounds;
return new PointF(r.Left + r.Width / 2, r.Top);
}
I hope that helps,
Stoyan