Skip to contents

Given the design matrix, checks that all the blocks are connected between them. Without leaving any block not connected or some blocks isolated from the others.

Usage

correct(x)

Arguments

x

Design matrix, a symmetric matrix with weights between 0 and 1.

Value

A logical value if it is fully connected or not.

References

See this question and answer about how it is done: https://math.stackexchange.com/a/551947

Examples

C <- matrix(0, nrow = 4, ncol = 4, dimnames = list(LETTERS[1:4], LETTERS[1:4]))
(m1 <- subSymm(C, 1, 2, 1))
#>   A B C D
#> A 0 1 0 0
#> B 1 0 0 0
#> C 0 0 0 0
#> D 0 0 0 0
correct(m1) # Several blocks wouldn't be connected
#> [1] FALSE
(m2 <- subSymm(m1, 3, 4, 1))
#>   A B C D
#> A 0 1 0 0
#> B 1 0 0 0
#> C 0 0 0 1
#> D 0 0 1 0
correct(m2) # All blocks are connected, but there are two networks.
#> [1] FALSE
(m3 <- subSymm(m2, 1, 4, 1))
#>   A B C D
#> A 0 1 0 1
#> B 1 0 0 0
#> C 0 0 0 1
#> D 1 0 1 0
correct(m3) # All blocks are connected and there is a single network
#> [1] TRUE