boundary: Returns the Boundary between a Graph and a SubGraph

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/graphfunctions.R

Description

The boundary of a subgraph is the set of nodes in the original graph that have edges to nodes in the subgraph. The function boundary computes the boundary and returns it as a list whose length is the same length as the number of nodes in the subgraph.

Usage

1
boundary(subgraph, graph)

Arguments

graph

the original graph from which the boundary will be created

subgraph

can either be the vector of the node labels or the subgraph itself.

Details

The boundary of a subgraph is the set of nodes in the graph which have an edge that connects them to the specified subgraph but which are themselves not elements of the subgraph.

For convenience users can specify the subgraph as either a graph or a vector of node labels.

Value

This function returns a named list of length equal to the number of nodes in subgraph. The elements of the list correspond to the nodes in the subgraph. The elements are lists of the nodes in graph which share an edge with the respective node in subgraph.

Author(s)

Elizabeth Whalen and R. Gentleman

See Also

subGraph, graph-class

Examples

1
2
3
4
  set.seed(123)
  g1 <- randomGraph(letters[1:10], 1:4, p=.3)
  ##both should be "a"
  boundary(c("g", "i"), g1)

Example output

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

$g
[1] "a"

$i
[1] "a"

graph documentation built on Nov. 8, 2020, 6:02 p.m.