pathdist {lazy.mat}R Documentation

Calculation of Path Distance

Description

Calculation of Path Distance

Usage

pathdist(S, minS = 1, sort = 2, navalue = 1.5, dump = 0, print = 1, debug = 0)

Arguments

S

Input path matrix
S[i,j] >= minS means that member i is connected to member j.
( Member i talks to member j. Asymmetric relationship.)
Default value of the diagonal elements are 1.

minS

The smallest value of S matrix which indicates connection.
Default value is 1.

sort

= 0 not to sort the result
= 1 to sort the result descendingly by the block size.

navalue

A constant to be used to calculate Robinsonian form.
Change this when the Robinson matrix seems strange.

dump

= 1 to output the # of paths of length L, L=2,3,... .

print

= 1 to print result

debug

= 1 to print intermediate result

Details

Let V[,,1] = S. Then, the number of paths of length L, L=2,3,... can be calculated as
V[,,L] = S %*% V[,,L-1] - Diag(S) %*% V[,,L-1] - S %*% Diag(V[,,L-1]) + Diag(S) %*% Diag(V[,,L-1])
Elementwise,
V[i,j,L] = \sum_{k!=i & k!=j} S[i,k] V[k,j,L-1]

By default, the rows and columns of the resulting matrices will be sorted in order to facilitate the interpretation.

Value

S ns x ns input path matrix
D ns x ns minimum path distance from i to j.
D[i,j]=L member i can reach member j via L-1 menbers.
D[i,j]=NA means no conection.
C ns x ns connection from i to j
C[i,j]=1 means i and j are connected, C[i,j]=0 means no connection.
SS ns x ns sorted input path matrix
DD ns x ns sorted minimum path dist from i to j
CC ns x ns sorted connection from i to j
nblk 1 x 1 # of blocks
sblk nblk x 1 # of members in each block
sort 1 x 1 sort parameter
od ns x 1 new order of original row/col
that is, to sort, use SS = S[order, order]
error 1 x 1 = 0 if the connection matrix can be block diagonalized.
V An array of the V[,,L] matrices

Examples

set.seed(1701)
n <- 8
S <- sample( c(0,0,0,0,0,1), n*(n-1)/2, replace=1 )
S <- vechinv(S,nodiag=1)
res <- pathdist(S, print=2, dump=1)


[Package lazy.mat version 0.1.4 Index]