compareShortestPath: compare intra-cluster shortest distance to overall shortest...

Description Usage Arguments Details Value Examples

View source: R/compareShortestPath.R

Description

compare intra-cluster shortest distance to overall shortest distance of the network

Usage

1
compareShortestPath(net, pheno, plotDist = FALSE, verbose = TRUE)

Arguments

net

(data.frame) network on which to compute shortest path. SOURCE, TARGET, WEIGHTS. Column names are ignored but expects a header row. Distances will be computed based on the third column

pheno

(data.frame) Node information. ID (node name) and GROUP (cluster name)

plotDist

(logical) if TRUE, creates a violin plot showing the shortest path distributions for each group.

verbose

(logical) print messages

Details

Uses Dijkstra's algorithm for weighted edges. Pairwise nodes with infinite distances are excluded before computing average shortest path for a network. This function requires the igraph package to be installed.

Value

(list) Two lists, 'avg' and 'all'. keys are cluster names. values for 'avg' are mean shortest path ; for 'all', are all pairwise shortest paths for subnetworks that contain only the edges where source and target both belong to the corresponding cluster. In addition, there is an 'overall' entry for the mean shortest distance for the entire network.

Examples

1
2
3
data(silh); 
colnames(silh$net)[3] <- 'weight'
compareShortestPath(silh$net, silh$groups)

netDx documentation built on Dec. 11, 2020, 2:01 a.m.