pkgnet icon indicating copy to clipboard operation
pkgnet copied to clipboard

DependencyReporter: vizNetwork's visHierarchicalLayout does not generate a very good layout

Open jayqi opened this issue 5 years ago • 7 comments

There should be a way to show things flowing in one direction, but as one can see, there is stuff going multiple ways.

Screen Shot 2019-03-13 at 5 42 15 PM

jayqi avatar Mar 13 '19 22:03 jayqi

Involves changing code here: https://github.com/UptakeOpenSource/pkgnet/blob/71d7fa8d08cf3c875ad243a3a3078a3c37dbf956/R/PackageDependencyReporter.R#L224-L232

jayqi avatar Mar 13 '19 22:03 jayqi

Setting the hierarchical layout enabled parameter to FALSE, makes it look less tangled by restricting edges to be between consecutive levels. However I think it also reduces the size and readability. The images before and after for reference:

Before: image

After: image

drkarthi avatar Sep 25 '19 23:09 drkarthi

This is another layout option without the levels: image

drkarthi avatar Sep 25 '19 23:09 drkarthi

Interesting @drkarthi. So disabling the hierarchical layout seems to yield a less dense but still hierarchical layout? What is the lowest node in your example above with hierarchical layout disabled?

bburns632 avatar Sep 26 '19 15:09 bburns632

The lowest node in the example is ggplot2, which was the package I was creating a report for. Yes, it seems to be using some algorithm to optimize the layout when hierarchical layout is disabled. This is the definition I found for the default layout:

improvedLayout: Boolean. Default to true. When enabled, the network will use the Kamada Kawai algorithm for initial layout. For networks larger than 100 nodes, clustering will be performed automatically to reduce the amount of nodes. This can greatly improve the stabilization times. If the network is very interconnected (no or few leaf nodes), this may not work and it will revert back to the old method. Performance will be improved in the future.

drkarthi avatar Sep 27 '19 12:09 drkarthi

Since we know the dependencies should form a DAG and there are no possible incoming edges to the root package (whatever you're creating a report for), it should be possible to stick the root package at the top and have only downward-pointing arrows in the whole graph. I don't think it's necessarily desirable to have arrows only connecting adjacent rows.

Regarding whether to stick the root at the top or bottom - I think it's nice to think of one's creations as "resting atop" the work of others, like layers of digital sediment being laid down or standing on the shoulders of giants. =) Or from a practical point of view, as you visually scroll down the graph, you first see the root, then you "dig through" the layers of dependencies.

One thing I don't get - in the current layout, there seem to be edges that have no direction. What do those mean?

kenahoo avatar Feb 13 '20 17:02 kenahoo

Hi @kenahoo,

Thanks for your resurfacing this discussion. I agree that the package in focus would look best atop the DAG structure. That way the graphic would read something like "scroll down for more detail/sediment :)"  @drkarthi and the team here were hoping to find either a vizNetwork or equivalent solution for drawing these graphs as desired (rather that investing time in building our own) . Do you have any suggestions?

Regarding the directionless edges, there are none. I believe what you are seeing there is an effect of the rendering.

For example, I believe what you see here is four different overlapping edges all ending at tools.

image

bburns632 avatar Feb 13 '20 23:02 bburns632