I do not know if there is an easy way with Graph
, unfortunately.
The older (and deprecated) GraphPlot
has this feature through the MultiedgeStyle
option.
One way with Graph
, which only works for some graph layouts, is the following:
Graph[{1 -> 2, 1 -> 2, 1 -> 2, 1 -> 2}, EdgeShapeFunction ->
Function[{pts, edge},
Module[
{stretch = 2, first = First[pts], last = Last[pts], med, mid},
med = Median[pts];
mid = (first + last)/2;
Arrow@BezierCurve[{first, mid + stretch (med - mid), last}]
]
]]
Set the stretch
factor to spread the multi-edges.
This method assumes that multi edges are simple arcs from the starting point to the endpoint. With GraphLayout
s such as "LayeredDigraphEmbedding"
, or with explicitly set "EdgeLayout"
s, this is not the case. Thus if you use this in a general function, I recommend setting the GraphLayout
explicitly to something which generally works well, such as "SpringElectricalEmbedding"
.
EdgeShapeFunction
see e.g.: 66784. Anyway, could you provide something to working with? That is a small multiedge graph? $\endgroup$