Skip to contents

This function takes an adjacency matrix generated with make_adjacency as input and converts it to a binary matrix using a binarization threshold.

Usage

make_binary(adj, threshold, output_plot = FALSE)

Arguments

adj

an adjacency matrix converted from a raw input matrix via make_adjacency.

threshold

a numeric value that is within the range min(adj) < threshold <= max(adj) of the input which is then used for binarisation.

Author

Ilias Moutsopoulos and Hajk-Georg Drost

Examples

# look at raw matrix
edgynode::adjacency_matrix_test_3
#>      [,1] [,2] [,3]
#> [1,]    0   -1    2
#> [2,]    1    2    4
#> [3,]    4    0    0
# convert raw matrix into a edgynode adjacency matrix
edgynode_matrix <- edgynode::make_adjacency(edgynode::adjacency_matrix_test_3)
# convert into a binary matrix
edgynode_matrix_binary <- edgynode::make_binary(edgynode_matrix, threshold = 1)
# look at result
edgynode_matrix_binary
#>    N1 N2 N3
#> N1  0  0  1
#> N2  1  1  1
#> N3  1  0  0
#> attr(,"class")
#> [1] "adjacency" "matrix"    "array"    
#> attr(,"known_symmetric")
#> [1] FALSE
#> attr(,"known_binary")
#> [1] TRUE