This is a follow-up question to: Unable to export a formatted graph?
I trying to layout a graph so that if you zoom in on a vertex, things look nice. To see what I mean by nice, let me just describe how I would like to make the edges connect to the vertices with a few examples:
Here's my starting point, with a simple graph using a typical layout:
CompleteGraph[5,
VertexShape ->
Table[n ->
Graphics[
Inset[Style[n, FontFamily -> "Source Sans Pro", FontSize -> 25,
Background -> None]]], {n, 5}],
EdgeStyle -> Directive[AbsoluteThickness[5], CapForm["Round"]],
VertexSize -> 0.25, PerformanceGoal -> "Quality", ImageSize -> 200]
This looks great, but if you zoom in on the vertices, we can start to see some issues. The minimum distances from the glyph to the edges vary a lot, moreover the curve through the edge endpoints isn't short and smooth.
So we don't simply want our edge endpoints equidistant from the vertex center coordinate. Instead we want edges sensitive to some bounding oval of the vertex label's glyph, like this:
Here's another more detailed example for vertex 3, which shows on the left what we start with, and and the right what I want.
Perhaps there's a simple way to do this, RegionNearest
comes to mind, but may be overkill:
r = RegionNearest[Disk[{0, 0}, {3, 4}], {5, 5}];
Graphics[{{LightGray, Disk[{0, 0}, {3, 4}]},
Inset[Style["3", FontSize -> 250, FontColor -> Black], {0,
0}], {PointSize[Large], {Red, Point[{5, 5}]}, {Blue, Point[r]},
Line[{{5, 5}, r}]}}]