DominikRafacz/deepdep

plot_dependencies with too high depth

Closed this issue · 2 comments

Describe the bug
When using plot_dependencies with depth argument too high (or on deepdep results created with too high argument) an unhandled error is thrown. I suspect this happens when depth is higher that maximum graph depth, e.g. package has dependencies which doesn't have any "subdependencies" and depth = 2 will throw this error.

On the other hand when package has no dependencies it works just fine.

How to reproduce?
Steps to reproduce the behavior:

library("deepdep")
results <- deepdep("dplyr", depth = 4)
plot_dependencies(results)

# Or directly
plot_dependencies("dplyr", depth = 4)

What works:

# This works fine even though data.table has no dependencies
plot_dependencies("data.table", depth = 10)

# This also works fine - notice that last level (depth 3) has no further dependencies
plot_dependencies("dplyr", depth = 3)

Expected behavior
Expected the dependencies to plot regardless of whether the depth was higher than the dependency tree or not.

Screenshots
image

Session info

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=Polish_Poland.1250  LC_CTYPE=Polish_Poland.1250    LC_MONETARY=Polish_Poland.1250
[4] LC_NUMERIC=C                   LC_TIME=Polish_Poland.1250    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] deepdep_0.2.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1         pillar_1.4.1       compiler_3.5.3     viridis_0.5.1      tools_3.5.3        zeallot_0.1.0     
 [7] digest_0.6.18      jsonlite_1.6       viridisLite_0.3.0  tibble_2.1.3       lifecycle_0.1.0    gtable_0.3.0      
[13] pkgconfig_2.0.2    rlang_0.4.0        tidygraph_1.1.2    igraph_1.2.4.1     rstudioapi_0.10    curl_3.3          
[19] ggrepel_0.8.1      gridExtra_2.3      httr_1.4.0         dplyr_0.8.3        vctrs_0.2.0        graphlayouts_0.5.0
[25] grid_3.5.3         tidyselect_0.2.5   glue_1.3.1         R6_2.4.0           ggraph_2.0.0       polyclip_1.10-0   
[31] tidyr_1.0.0        ggplot2_3.2.0      purrr_0.3.3        tweenr_1.0.1       farver_2.0.1       magrittr_1.5      
[37] scales_1.0.0       backports_1.1.5    MASS_7.3-51.1      assertthat_0.2.1   ggforce_0.3.1      colorspace_1.4-1  
[43] lazyeval_0.2.2     munsell_0.5.0      crayon_1.3.4

Ditto:

plot_dependencies(deepdep('tidyverse', 5L), 'circular')

Finally I've found enough time and motivation to dig into this problem!
It turns out that it was caused by two independent factors:

  • the deepdep function did not correctly mark packages about which it had already downloaded information, so for more complex dependency networks loops appeared
  • the layer number, on which the packet in the graph should be placed, was counted incorrectly

Both bugs have been fixed in commits 355bc0c and e3a826c . Now it works as it should:

dplyr
tidyverse