mstUB Compute the shortest path upper bound for all unknown entries in a partial distance matrix

mstUB(A)

Arguments

A

A (connected) partial distance matrix, with unknown entries set to Inf

Value

UB A matrix containing the upper bounds for only the unknown entries. All other entries will be set to Inf.

Details

This function uses the shortest.paths() function, available in the igraph package.

Examples

A <- dist(cbind(rnorm(10,0,1),rnorm(10,0,1))) mstUB(as.matrix(A))
#> 1 2 3 4 5 6 7 #> 1 0.0000000 0.4082502 2.0332915 1.6993090 1.1616339 2.993490 2.197154 #> 2 0.4082502 0.0000000 2.0118739 1.5383777 0.7909783 2.748551 1.849635 #> 3 2.0332915 2.0118739 0.0000000 0.7535192 1.7884934 4.594294 3.465850 #> 4 1.6993090 1.5383777 0.7535192 0.0000000 1.1039767 3.919922 2.754657 #> 5 1.1616339 0.7909783 1.7884934 1.1039767 0.0000000 2.818141 1.679453 #> 6 2.9934897 2.7485509 4.5942940 3.9199220 2.8181412 0.000000 1.234647 #> 7 2.1971540 1.8496354 3.4658504 2.7546573 1.6794527 1.234647 0.000000 #> 8 1.4871935 1.2864751 0.9978427 0.2847686 0.8202225 3.637596 2.479780 #> 9 1.1214929 0.7340962 1.8898248 1.2147238 0.1147769 2.710753 1.584252 #> 10 1.3146460 1.1813254 0.8979166 0.3881314 0.9012353 3.696542 2.580239 #> 8 9 10 #> 1 1.4871935 1.1214929 1.3146460 #> 2 1.2864751 0.7340962 1.1813254 #> 3 0.9978427 1.8898248 0.8979166 #> 4 0.2847686 1.2147238 0.3881314 #> 5 0.8202225 0.1147769 0.9012353 #> 6 3.6375956 2.7107533 3.6965419 #> 7 2.4797804 1.5842517 2.5802388 #> 8 0.0000000 0.9303609 0.2760197 #> 9 0.9303609 0.0000000 0.9973354 #> 10 0.2760197 0.9973354 0.0000000