# Graph visualization: Leave gap between vertex and endpoint of edge

This is a nice graph:

g = CycleGraph[4];

Graph[g, VertexCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}},
VertexLabels -> Placed["Name", Center], VertexSize -> Medium,
EdgeShapeFunction ->
GraphElementData[{"CurvedArc", "Curvature" -> 0.5}]]


But I want that the edges separated by an offset from the vertices. Is there a simple way to control this within GraphElementData, similarly to how I could control the curvature? I want also an arrow but if I add "CarvedArrow", "ArrowSize" -> .1 to "CurvedArc", "Curvature" -> 0.5 MA does'nt display anything.

• Where are your g?
– yode
Commented Nov 10, 2016 at 7:58
• Please always put the code in a code block. Select the code with the mouse and press the {} button on the toolbar. I'm going to edit the post for you now, but please do this every time in the future when you post. I see several downvotes, no doubt the lack of formatting contributed to that (as well as the lack of a concrete g, which I'm going to also edit into the post now). Commented Nov 10, 2016 at 9:15
• Sorry not to have respected the standard I certainly was not correctly awaked. the graph was g = {a0 -> b0, b0 -> c0 , c0 -> d0, d0 -> a0}. Normaly I try to pay attention to this. I often fail. Commented Nov 10, 2016 at 9:21
• OK, so the adding CycleGraph was exactly what you meant then. Commented Nov 10, 2016 at 9:43
• Yes and the answer was perfect Commented Nov 10, 2016 at 10:34

ClearAll[esF]
esF[setback_: .2, as_: .1] := {Arrowheads[as],
Arrow[GraphElementData[{"CurvedArc", "Curvature" -> 0.5}][##], setback]} &;

g0 = Graph[{a0 -> b0, b0 -> c0, c0 -> d0, d0 -> a0},
VertexCoordinates -> {{0, 0}, {0, 1}, {1, 1}, {1, 0}},
VertexLabels -> Placed["Name", Center], VertexSize -> Medium,
ImageSize -> 250];

SetProperty[g0, EdgeShapeFunction -> esF[]]


Row[Labeled[SetProperty[g0, EdgeShapeFunction -> esF[#]],
"setback: " <> ToString[#], Top] & /@ {.2, {0, .2}, {.2, .4}}]


Row[Labeled[SetProperty[g0, EdgeShapeFunction -> esF[.2, #]],
"size: " <> ToString[#], Top] & /@ {.1, .2, Small, Large}]