magjac / d3-graphviz

Graphviz DOT rendering and animated transitions using D3
BSD 3-Clause "New" or "Revised" License
1.68k stars 103 forks source link

problem with entering edges direction when dir attribute is "back" #220

Open kasra0 opened 2 years ago

kasra0 commented 2 years ago

Hi,

digraph {
     rankdir="LR"
      node [shape="circle" fixedsize=1]
      center -> right  [style="none"]
      left  -> center  [style="invis" dir="back"]
}

When we change the style attribute value from "invis" to "none" the entering edge for center -> right goes from center node to the right node ( logic behavior) the entering edge for left -> center goes from left node to the center node but the dir attribute is "back". The entering edge should go from center node to left node.

this example shows the problem.

Another example would be with Circo layout. If the edges are from outside to the center using the dir attribute then we have the same issue.

A solution would be using the neato layout, doing all the positioning, and having the right direction by default without using the dir attribute but I lose all the simplicity of the dot layout.

Thanks for your help.

magjac commented 2 years ago

Haha. Yes, that's a use case I haven't thought of. Thanks for the report. Maybe it's possible to detect this somehow and do a better job. I wonder how to best grow entering edges with dir="both" or dir="none".

kasra0 commented 2 years ago

I think that dir="both" and dir="none" should be treated the same way. A simple fade-in ( entering )/out (exiting) behavior at the edge position should be enough. dir="none" does not specify direction so it makes sense just having a fade behavior. dir="both" either as choosing a direction here is by definition wrong. If you really want to implement a grow entering then from the center of the edge seems to be the best solution ( but in that case I don't know if it's straightforward)

What do you think?

kasra0 commented 2 years ago

Hi,

do you plan to solve this issue anytime soon or not at all ?

thanks in advance.