getReachableNodes: getReachableNodes function

Description Usage Arguments Value Examples

View source: R/getReachableNodes.R

Description

getReachableNodes is a support function for inferring reachable nodes that have some directed path to a node targetNode. This function uses Breadth-first search (BFS) algorithm.

Usage

1
getReachableNodes(adjMat, targetNode)

Arguments

adjMat

is an adjacency matrix of a following network of which its elements are binary: zero for no edge, and one for having an edge.

targetNode

is a node in a graph that we want to find a set of nodes that can reach this target node via some paths.

Value

This function returns a set of node IDs followers that have some directed path to a node targetNode.

Examples

1
2
3
4
5
6
7
8
# Given an example of adjacency matrix
A<-matrix(FALSE,5,5)
A[2,1]<-TRUE
A[c(3,4),2]<-TRUE
A[5,3]<-TRUE
# Get a set of reachable nodes of targetNode.

followers<-getReachableNodes(adjMat=A,targetNode=1)$followers

mFLICA documentation built on Jan. 24, 2022, 5:09 p.m.