shortestPathDistance: Return a Matrix with the shortest path distance between nodes...

View source: R/betaMix.R

shortestPathDistanceR Documentation

Return a Matrix with the shortest path distance between nodes (check up to numSteps.)

Description

return the adjacency matrix of expMat connecting neighbors up to numSteps away.

Usage

shortestPathDistance(AdjMat, numSteps = 0)

Arguments

AdjMat

An adjacency Matrix (0/1).

numSteps

The maximum number of edges between pairs of nodes. If numSteps=0, returns the input matrix. numSteps=1 adds neighbors of direct neighbors, etc.

Value

A Matrix containing the shortset paths between nodes i and j

Examples

## Not run: 
   data(SIM,package = "betaMix")
   res <- betaMix(betaMix::SIM, maxalpha = 1e-6,ppr = 0.01,subsamplesize = 30000, ind=TRUE)
   adjMat <- getAdjMat(res)
   AdjMat <- shortestPathDistance(adjMat, numSteps=2)
   Matrix::image( (AdjMat>0)[1:200,1:200])
   adjMat1 <- AdjMat>0
   SimComp <- graphComponents(adjMat1)
   head(summarizeClusters(SimComp))

## End(Not run)

haimbar/betaMix documentation built on Jan. 3, 2023, 12:54 p.m.