Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

boundary

Returns the Boundary between a Graph and a SubGraph


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

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

Examples

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

graph

graph: A package to handle graph data structures

v1.68.0
Artistic-2.0
Authors
R. Gentleman, Elizabeth Whalen, W. Huber, S. Falcon
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.