<% 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 excluded from this table.

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

Heaviness on <%=pkg$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 upstream package to all its child packages' Suggests. Then we denote $n_{2k}$ as the number of strong dependencies of <%=pkg$package%> in the reduced dependency graph. The heaviness from upstream package is calculated as $n_{1k} - n_{2k}$.

The full table can be obtained by upstream_dependency('<%=pkg$package%>').

<% 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 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 into 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.

<% } %>