R: Head and tail of edge position on node

I need to specify the position of the head/tail on a node. For instance the head of the edge can start from the top, bottom, left, or right of a node (in addition to top-left or bottom-left diagonals).

Let’s say you have three nodes laid out horizontally on the same y-coordinate and want to include edges to connect them all. The problem is that the edge connecting the left-most node and right-most node will pass through the middle node because by default the head position of the edge will be on the right and the tail position of the edge will be on the left of their respective nodes.

This can be solved by allowing a specification that the edge connecting the left-most and right-most nodes, should have a head and tail position on the top (or bottom) of their respective nodes. If this edge is curved, then it will no longer interfere with the middle most node as it will pass above (or below) it no matter the distance.

How about using curved edges?

g <- make_graph(c(1,2, 2,3, 1,3))
plot(g, layout=matrix(c(0,0, 1,0, 2,0), ncol=2, byrow = T), edge.curved=0.5)

image