christophergandrud / networkD3

D3 JavaScript Network Graphs from R
http://christophergandrud.github.io/networkD3
650 stars 269 forks source link

hierarchical forceNetwork()s #241

Closed wlandau closed 6 years ago

wlandau commented 6 years ago

Please forgive my naive question, but is it possible to arrange directed forceNetwork() DAGs such that all the edges point from left to right? I am looking for something like the Sugiyama layout for igraphs.

cjyetman commented 6 years ago

Not sure exactly what you mean, but... networkD3 and forceNetwork() typically attempt to produce "ideal" layouts automatically, so predetermining things like direction of edges (physical direction in the plot, not direction of link between nodes) goes against its purpose.

wlandau commented 6 years ago

In that case, what is currently available besides sankeyNetwork()? Direction is important for visualizing the chronological execution order of drake dependency graphs, which are always DAGs, but not always trees.

cjyetman commented 6 years ago

forceNetwork() can display arrows for the direction of each link/edge with the arrows = TRUE parameter, but you cannot predetermine the x/y location of each node because that works against the primary purpose of the forceNetwork() function (to use a psuedo-physics simulation to determine the x/y location of nodes based on attraction, repulsion, link strength, etc.)

At the moment, I don't think networkD3 has a function that precisely serves your purpose.

wlandau commented 6 years ago

Useful to know, I will keep a lookout. If hierarchical DAG layouts do become possible at some point, I will be able to completely switch over from visNetwork to networkD3.