Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make nice-looking plots of dependency trees #14

Closed
wlandau-lilly opened this issue Mar 23, 2017 · 5 comments
Closed

Make nice-looking plots of dependency trees #14

wlandau-lilly opened this issue Mar 23, 2017 · 5 comments
Assignees

Comments

@wlandau-lilly
Copy link
Collaborator

It should be as simple as DiagrammeR::from_igraph(build_graph(...)), but from_igraph() does not yet work for me.

With DiagrammeR, I should also be able to assign different node colors for objects, functions, files, targets, etc. Maybe I can color edges by whether a target is created with a command or imported.

@wlandau-lilly
Copy link
Collaborator Author

See rich-iannone/DiagrammeR#219.

@wlandau-lilly wlandau-lilly changed the title Make nice-looking plots of dependency trees with DiagrammeR. Make nice-looking plots of dependency trees May 22, 2017
@wlandau-lilly
Copy link
Collaborator Author

wlandau-lilly commented May 22, 2017

@enantz-lilly suggested visNetwork. (This need not replace DiagrammeR. Users could choose the backend.)

library(visNetwork)
igraph_object = drake:::dbug()$graph
network_data = toVisNetworkData(igraph_object)
network_data$edges$arrows = "to" # For directed edges
visNetwork(nodes = network_data$nodes, edges = network_data$edges, height = "500px")

It would also be nice to have different-looking nodes for imports vs targets or files vs functions vs non-function objects.

@wlandau-lilly
Copy link
Collaborator Author

CodeDepends uses Rgraphviz, but that one is on Bioconductor.

@wlandau-lilly
Copy link
Collaborator Author

wlandau-lilly commented Jul 12, 2017

I will release improved plotting functionality with the next version of drake. Here's what it looks like in the development version. Now is a great time for suggestions and requests.

attach(drake:::dbug()) # Workflow and environment I use for debugging
envir$f = function(x) g(x) + a + NOT_FOUND # Sometimes some symbols cannot be imported as objects. Drake just rolls with it, even in make().
plot_graph(plan = plan, envir = envir) # Build and render the graph

graph

@wlandau-lilly wlandau-lilly added this to the v3.0.1 milestone Jul 12, 2017
@wlandau-lilly
Copy link
Collaborator Author

wlandau-lilly commented Jul 12, 2017

Even better: let's sort the graph from left to right and show everyone how the parallel computing works. In the new graph below, each column is a separate parallelizable stage. When you call make(), you go from left to right, and the targets in the current column are distributed over the available parallel jobs. In other words, you have parallelism within columns, and you move sequentially from one column to the next. In the example below, we can do the first 7 targets in parallel, then j and myinput in parallel, and then there's the unavoidably sequential move to h, and so on.

better

For those who are curious, I am now happily committed to visNetwork. I set the "level" column in the "nodes" data frame in visNetwork() and then call visHierarchicalLayout(direction = "LR").

Before I officially mark this issue as solved, I need to say more about graphing in the quickstart vignette at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant