Connecting a node to the edge between two other nodes


Hello experts,

I am currently trying to create a flowchart using DiagrammeR

> library(DiagrammeR)
> grViz("
+   digraph g { 
+       subgraph cluster_0 {
+       style=filled;
+       color=lightgrey;
+       label= To_Accrue
+       node [shape = rectangle, style = filled, fillcolor = Linen]
+       A
+       B
+       C
+       A->B->C
+       }
+       subgraph cluster_1 {
+       style=filled;
+       color=crimson;
+       label= Y
+       node [style=filled,color=blue, shape=folder]
+       1
+       2
+       3
+       1->2->3
+       }
+       }
+       ")

Please refer to the link File to see what it currently generates (Tab-Sheet1). I was wondering if there is a way to achieve the desired output (Tab-Desired Output).

Thank you in advance.



In graph objects (what is created with the digraph command), every edge connects two nodes. To connect a third node to an edge, you would need to create a fourth node between the first and second, giving you two edges.

This is not, of course, how GUI programs like Visio work (although you do get a node-analog in the form of an invisible connection point).



@technocrat thanks for the response. I am new to R and I can't code what you suggested. Is it kindly possible for you to put that in a code please?



I don't have that package installed, but you would create the configuration by removing the two existing nodes (and the edge), creating four new nodes. Let D be the target on the edge, C the new node and A and B the existing nodes.

A <-> C
C <-> D
D <-> B

in the same way you created A <-> B



It is resolved here Solve


closed #6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.