Skip to contents

This function takes an adjacency matrix as input and checks if it is symmetric.

Usage

is_symmetric(adj)

Arguments

adj

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

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
clean_matrix <- edgynode::make_adjacency(edgynode::adjacency_matrix_test_3)
# make clean matrix symmetric
clean_matrix_symm <- edgynode::make_symmetric(clean_matrix)
# look at symmetric matrix
clean_matrix_symm
#>    N1 N2 N3
#> N1  0  1  4
#> N2  1  2  4
#> N3  4  4  0
#> attr(,"class")
#> [1] "adjacency" "matrix"    "array"    
#> attr(,"known_symmetric")
#> [1] TRUE
#> attr(,"known_binary")
#> [1] FALSE
# test converted matrix
edgynode::is_symmetric(clean_matrix_symm)
#> [1] TRUE