Find the subgraph induced by including specific packages. The induced subgraph is the graph that includes the named packages and all edges connecting them. This is useful for a developer, for example, to examine her packages and their intervening dependencies.

inducedSubgraphByPkgs(g, pkgs, pkg_color = "red")

Arguments

g

an igraph graph, typically created by buildPkgDependencyIgraph

pkgs

character() vector of packages to include. Package names not included in the graph are ignored.

pkg_color

character(1) giving color of named packages. Other packages in the graph that fall in connecting paths will be colored as the igraph default.

Examples

library(igraph)
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 = inducedSubgraphByPkgs(g, pkgs=c('GenomicFeatures',
'TCGAbiolinksGUI', 'BiocGenerics', 'org.Hs.eg.db', 'minfi', 'limma'))
g2
#> IGRAPH ae4047e DN-- 5 3 -- 
#> + attr: name (v/c), color (v/c), edgetype (e/c)
#> + edges from ae4047e (vertex names):
#> [1] GenomicFeatures->BiocGenerics minfi          ->BiocGenerics
#> [3] minfi          ->limma       
V(g2)
#> + 5/5 vertices, named, from ae4047e:
#> [1] BiocGenerics    GenomicFeatures minfi           limma          
#> [5] org.Hs.eg.db   

plot(g2)