multiNode.getNodeRanks {CTD} | R Documentation |
Generate multi-node node rankings ("adaptive" walk)
Description
This function calculates the node rankings starting from a given node in a subset of nodes in a given network, G.
Usage
multiNode.getNodeRanks(S,G,p1,thresholdDiff,adj_mat,num.misses=NULL,
verbose=FALSE,out_dir="",useLabels=FALSE,
coords=NULL)
Arguments
S |
- A character vector of the node names for the subset of nodes you want to encode. |
G |
- A list of probabilities with list names being the node names of the network. |
p1 |
- The probability that is preferentially distributed between network nodes by the probability diffusion algorithm based solely on network connectivity. The remaining probability, 1-p1, is uniformally distributed between network nodes, regardless of connectivity. |
thresholdDiff |
- When the probability diffusion algorithm exchanges this amount or less between nodes, the algorithm returns up the call stack. |
adj_mat |
- The adjacency matrix that encodes the edge weights for the network, G. |
num.misses |
- The number of "misses" the network walker will tolerate before switching to fixed length codes for remaining nodes to be found. |
verbose |
- If TRUE, print statements will execute as progress is made. Default is FALSE. |
out_dir |
- If specified, a image sequence will generate in the output directory specified. |
useLabels |
- If TRUE, node names will display next to their respective nodes in the network. If FALSE, node names will not display. Only relevant if out_dir is specified. |
coords |
- The x and y coordinates for each node in the network, to remain static between images. |
Value
ranks - A list of character vectors of node names in the order they were drawn by the probability diffusion algorithm, from each starting node in S.
Examples
# Read in any network via its adjacency matrix
adj_mat=rbind(c(0,1,2,0,0,0,0,0,0), #A's neighbors
c(1,0,3,0,0,0,0,0,0), #B's neighbors
c(2,3,0,0,1,0,0,0,0), #C's neighbors
c(0,0,0,0,0,0,1,1,0), #D's neighbors
c(0,0,1,0,0,1,0,0,0), #E's neighbors
c(0,0,0,0,1,0,0,0,0), #F's neighbors
c(0,0,0,1,0,0,0,1,0), #G's neighbors
c(0,0,0,1,0,0,1,0,0), #H's neighbors
c(0,0,0,0,0,0,0,0,0) #I's neighbors
)
rownames(adj_mat)=c("A","B","C","D","E","F","G","H","I")
colnames(adj_mat)=c("A","B","C","D","E","F","G","H","I")
G=vector(mode="list", length=ncol(adj_mat))
names(G)=colnames(adj_mat)
S=names(G)[seq_len(3)]
ranks=multiNode.getNodeRanks(S, G, p1=0.9, thresholdDiff=0.01, adj_mat)