I want to draw dot graphs in R using diagrammeR, in which some nodes have arrows pointing to edges.
For example, this diagram
library(DiagrammeR)
grViz("
digraph PrimC{
graph [layout = dot]
node [shape = circle]
A B
A -> B [label = 'Rate']
}")
I would like to look something like this one (edited by hand). NB these types of diagram are commonly used to show when a rate is affected by the quantity of something else.
This answer suggests that using invisible nodes can achieve this, but does not actually show how. It links to this answer, which shows how to use invisible nodes for a somewhat different type of graph in which several edges meet at a single point, but does not include what I'm looking for with an edge pointing to the midpoint of another edge.
I've tried a number of different combinations of invisible nodes and edges, but can't get any of them close to what I want.
Here's one messy attempt as an example
grViz("
digraph PrimC{
graph [layout = dot]
node [shape = circle]
A B
node[shape=none, width=0, height=0, label=''];
p1
node [shape = circle]
B
A -> p1 [label = 'Rate']
p1 -> B
B -> p1;
{rank=same; A -> p1; B -> p1;}
}")
Is there any way to get this to work. Open to suggestions using other approaches than diagrammeR and graphviz, if there's a better solution out there.