View source: R/getReachableNodes.R
getReachableNodes | R Documentation |
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.
getReachableNodes(adjMat, targetNode)
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. |
This function returns a set of node IDs followers
that have some directed path to a node targetNode
.
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.