compareShortestPath {netDx} | R Documentation

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

### Description

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

### Usage

    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

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

[Package netDx version 1.1.4 Index]