在 Graphviz / DiagrammR 中向水平图形添加圆形反馈箭头

Add round feedback arrow to horizontal graph in Graphviz / DiagrammR

我喜欢在Graphviz图中添加反馈箭头,普通的“流”保持水平,但反馈应该是圆形的,如下图手动添加的蓝色箭头.

这是我到目前为止所尝试的。我将 DiagrammR 包用于 R 语言,但建议使用普通语言或 python Graphviz 或当然也会有帮助。

library("DiagrammeR")
grViz("digraph feedback {
         graph [rankdir = 'LR']
           node [shape = box]
             Population
           node [shape = circle]
             Source Sink
           node [shape = none]
             Source -> Growth -> Population -> Death -> Sink
             
             Population -> Growth [constraint = false]
             Death -> Population [constraint = false]
}")

您可以尝试使用 headport 和 tailport 选项并为这两个选项(人口和增长)指定“北”。

headport 是箭头与节点相交的主要方向。

tailport 是尾巴从节点发出的基本方向。

library("DiagrammeR")
grViz("digraph feedback {
         graph [rankdir = 'LR']
           node [shape = box]
             Population
           node [shape = circle]
             Source Sink
           node [shape = none]
             Source -> Growth -> Population -> Death -> Sink
             Population -> Growth [tailport = 'n', headport = 'n', constraint = false]
}")

输出