# Edge Styling in Graph funciton

Inside the Graph[] command, is there a way to "spread" multiedges apart? if you have many edges they get quite close together.

Specifically, I have many small graphs with multiedges which will themselves be vertices on a large graph, and I would like to be able to see all the edges even when the graph is small.

• Don't know if there is a GraphLayout which does this but at the end you could play with EdgeShapeFunction see e.g.: 66784. Anyway, could you provide something to working with? That is a small multiedge graph? – Kuba Aug 3 '17 at 10:53
• Thanks! I like this, except that I can't keep the middle edge "flat" since you specify the curvature for all edges between a particular two vertices simultaneously: Graph[{1, 2}, {1 <-> 2, 1 <-> 2, 1 <-> 2}, EdgeShapeFunction -> {1 <-> 2 -> GraphElementData[{"CurvedArc", "Curvature" -> 1}]}] – M. Brandt Aug 3 '17 at 11:03

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 GraphLayouts 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".