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

acc-methods

Methods for Accessibility Lists


Description

This generic function takes an object that inherits from the graph class and a node in that graph and returns a vector containing information about all other nodes that are accessible from the given node. The methods are vectorized so that index can be a vector.

Usage

## S4 method for signature 'graph,character'
acc(object, index)
## S4 method for signature 'clusterGraph,character'
acc(object, index)

Arguments

object

An instance of the appropriate graph class.

index

A character vector specifying the nodes for which accessibilty information is wanted.

Value

The methods should return a named list of integer vectors. The names of the list correspond to the names of the supplied nodes. For each element of the list the returned vector is named. The names of the vector elements correspond to the nodes that are accessible from the given node. The values in the vector indicate how many edges are between the given node and the node in the return vector.

Methods

object = graph

An object of class graph.

object = clusterGraph

An instance of the clusterGraph class.

index

A character vector of indices corresponding to nodes in the graph.

Examples

set.seed(123)
 gR3 <- randomGraph(LETTERS[1:10], M<-1:2, p=.5)
 acc(gR3, "A")
 acc(gR3, c("B", "D"))

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.