get_shortest_distances {Corbi}R Documentation

Calculate shortest distances of unweighted network

Description

Calculate all pairs of shortest distances of unweighted network

Usage

get_shortest_distances(
  net.matrix,
  source.nodes = rep_len(TRUE, dim(net.matrix)[1])
)

Arguments

net.matrix

Logical adjacency matrix of given unweighted network

source.nodes

Logical vector to indicate the source nodes that need to calculate the shortest distances

Details

This function calculates all pairs of shortest distances of unweighted network by using breadth-first-search (BFS) algorithm.

Value

This function will return the shortest distance matrix, where the element [i, j] is the shortest distance between node i and j. Value -1 means unreachable. If source.nodes[i] equals FALSE, the shortest distance from i to other nodes will not be calculated and the row i will be all -1.


[Package Corbi version 0.6-2 Index]