How to minimize edge crossings on Diagrammer? (MinQuit and MaxIter)




I've created a simple R script to summarize information from databases and generate network connection diagrams (graphs) from it.
In order to create that graphs I'm using the package Diagrammer, and I feed it with the information that goes to the nodes, edges and labels. I'm using this package because I need the result in vectorial (svg or pdf) format to include it on a paper (that discards Visnetwork),

But I've found a problem, with large diagrams the automatic positioning it's not good, it produces too many crossings and even overlappings, needing to manually position the nodes (and also the labels). This is a tedious because I do it with a vectorial editor.

I've been searching on the documentation and found references to parameters such as MinQuit, MaxIter, minlen and maybe maxlen and different ways to pass parameters to Diagrammer or graphviz.

Could you tell me how to use them, please?
I would also like to know how to control the spline curvature parameter.

This is a simplified version of my code that automatically takes the dataframe and produces the graph:

nodes <-   create_node_df(  n=length(nodesd), label=nodesd,  width=0.5, shape="circle",
penwidth=1, style = "filled" ) 
 edges <- create_edge_df(from = factor(myDT$from, levels=nodesd), to = factor(myDT$to, levels=nodesd),
rel = "leading_to", label=myDT$lab, penwidth=myDT$wid)  
graph <-   create_graph(  nodes_df = nodes, edges_df = edges)
graph <- add_global_graph_attrs(graph, "layout", "dot", "graph")
graph <- add_global_graph_attrs(graph, "splines","spline", "graph")
 graph <- add_global_graph_attrs(graph, "rankdir", "TB", "graph")  

You can use this small reproducible example:

myDT <- data.frame(from=c("a", "g", "z", "b", "b", "c", "d", "d", "e", "f", "f", 
        "a", "f", "h", "h", "k", "k", "g", "y"), to=c("c", "d", "f", "e", "f","a", "a", "a", "b", 
        "b",  "f", "b", "c", "k","e", "h", "a", "e", "z"), lab=1:19)
 nodesd <- c("a", "b", "c", "d", "e", "f", "g", "h", "k", "y", "z")

I've also tried with "curved" and with neato, twopi and circo layouts.

Visnetwork reallocates the nodes minimizing the problem but it doesn't let me export the diagram as vector graphic.

Here you can see the result with fewer nodes but still problematic. If the number is larger the result is a mess.

But the result looks like this
<img src='/uploads/tidyverse/original/2X/4/45939433928d472bdc202c9c9a441a04fb0d058e.png'

<img src='/uploads/tidyverse/original/2X/0/09518b03b8d733aa42f4ebcfb48f6ab8e0b5efbd.png'

I've asked at stackoverflow and diagrammer's github without any ansewer.

How can I force Diagrammer to position the nodes better?