<% if(n_total > 0) { %> <% if(n_used > 0) { %>

In total, <%=pkg$package%> has <%=n_total%> upstream package<%=ifelse(n_total > 1, 's', '')%>. Only <%=n_used%> upstream packages with heaviness on <%=pkg$package%> larger than 5 are listed in the following table. Note all 14 base packages (base, compiler, datasets, graphics, grDevices, grid, methods, parallel, splines, stats, stats4, tcltk, tools and utils) are removed from this table.

Dependency path: the shortest path from upstream package to <%=pkg$package%> in the global dependency graph. The form of A
k
B means package A contribute a direct heaviness of k on package B.

Heaviness from upstream on <%=pkg$package%>: number of required packages that can be reduced if moving upstream package to Suggests of all its child package. Denote $n_{1k}$ as the number of strong dependencies of <%=pkg$package%>. Since the upstream package can affect <%=pkg$package%> in an indirect manner, we recalculate the global dependency relations for all packages after moving the corresponding upstream package to all its child packages' Suggests. Then we denote $n_{2k}$ as the number of strong dependencies of <%=pkg$package%> in the modified dependency graph. The heaviness from upstream package is calculated as $n_{1k} - n_{2k}$.

<% el = upstream_dependency(pkg$package) g = igraph::graph.edgelist(as.matrix(unique(el[, 1:2]))) for(i in seq_len(nrow(upstream_tb))) { sp = igraph::all_shortest_paths(g, upstream_tb[i, 1], pkg$package)$res upstream_tb[i, "path"] = paste(sapply(sp, function(x) { p = names(x) txt = paste0("
", p[1], "") for(i in seq_len(length(p) - 1)) { txt = paste0(txt, "", "→
", df[["hv_downstream_values"]][[ p[i] ]][ p[i+1] ], "
", p[i+1], "") } paste0(txt, "
") }), collapse = "") upstream_tb[i, "path_len"] = max(sapply(sp, length)) } upstream_tb$package = qq("@{upstream_tb$package}", collapse = FALSE) %> <%= as.character(knitr::kable(upstream_tb, format = "html", row.names = FALSE, escape = FALSE, col.names = c("Upstream package", "Dependency path", "Dependency depth", qq("Heaviness from upstream on @{pkg$package}")), table.attr = "class='table table-striped'")) %> <% nr = n_used if(nr > 25) { %> <%= page_select2(page, ceiling(nr/25), "upstream_dependency", pkg$package) %> <% } %>

Dependency paths in the table are merged as the following graph with <%=length(unique(c(nt[, 1], nt[, 2])))%> nodes and <%=nrow(nt)%> edges. Reset graph | Horizontal layout

There are the two notes for the following graph:

Load graph
<% } else { %>

In total there are <%=n_total%> upstream dependencies, but no upstream package has heaviness larger than 5 on '<%=pkg$package%>'.

<% } %> <% } else { %>

No upstream dependency (not including base packages) found.

<% } %>