While the inducedSubgraphByPkgs returns the subgraph with the minimal connections between named packages, this function takes a vector of package names, a degree (1 or more) and returns the subgraph(s) that are within degree of the package named.

subgraphByDegree(g, pkg, degree = 1, ...)

Arguments

g

an igraph graph, typically created by buildPkgDependencyIgraph

pkg

character(1) package name from which to measure degree.

degree

integer(1) degree, limit search for adjacent vertices to this degree.

...

passed on to distances

Value

An igraph graph, with only nodes and their edges within degree of the named package

Examples


g = buildPkgDependencyIgraph(buildPkgDependencyDataFrame())
#> 'getOption("repos")' replaces Bioconductor standard repositories, see
#> 'help("repositories", package = "BiocManager")' for details.
#> Replacement repositories:
#>     CRAN: https://cloud.r-project.org
g2 = subgraphByDegree(g, 'GEOquery')
g2
#> IGRAPH 1eb57e8 DN-- 28 71 -- 
#> + attr: name (v/c), edgetype (e/c)
#> + edges from 1eb57e8 (vertex names):
#>  [1] bigmelon     ->Biobase    bigmelon     ->GEOquery  
#>  [3] bigmelon     ->minfi      bigmelon     ->methods   
#>  [5] Biobase      ->methods    ChIPXpress   ->Biobase   
#>  [7] ChIPXpress   ->GEOquery   DExMA        ->Biobase   
#>  [9] DExMA        ->GEOquery   DExMA        ->limma     
#> [11] DExMA        ->methods    DrugVsDisease->GEOquery  
#> [13] DrugVsDisease->limma      EpiMix       ->Biobase   
#> [15] EpiMix       ->GEOquery   EpiMix       ->limma     
#> + ... omitted several edges