I am using visNetwork package for creating small networks. Below script creates a simple network graph as shown in the visualization. My issue is that every time I execute the script, the positioning of the nodes keeps on changing. My requirement is that every time I run the script, I want the visualization to appear fixed and in order like the visual below, currently I had to manually move the edges to show what is needed. Also, I will take more nodes into the network, please help me with a scalable approach. Please help and thanks.
library(visNetwork)
visNetwork(dot = 'dinetwork {1 -> 1 -> 2; 2 -> 4; 2 -- 3; 2 -> 1 }', width =
"100%")