Last data update: 2014.03.03

R: Methods for Accessibility Lists
acc-methodsR Documentation

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"))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(graph)
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, xtabs

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

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, 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, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/graph/acc-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: acc-methods
> ### Title: Methods for Accessibility Lists
> ### Aliases: acc-methods acc,graph-method acc,clusterGraph-method acc
> ###   acc,graph,character-method acc,clusterGraph,character-method
> ### Keywords: methods
> 
> ### ** Examples
> 
>  set.seed(123)
>  gR3 <- randomGraph(LETTERS[1:10], M<-1:2, p=.5)
>  acc(gR3, "A")
$A
B C D E F G H J 
1 2 1 2 2 1 1 1 

>  acc(gR3, c("B", "D"))
$B
A C D E F G H J 
1 2 1 2 2 1 1 1 

$D
A B C E F G H J 
1 1 1 1 1 1 1 1 

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>