Learn R Programming

birankr (version 1.0.1)

sparsematrix_rm_weights: Remove sparse matrix edge weights

Description

Removes edge weights from sparse matrices.

Usage

sparsematrix_rm_weights(adj_mat)

Arguments

adj_mat

Sparse matrix of class dgCMatrix

Value

A sparse matrix of class dgCMatrix.

Examples

Run this code
# NOT RUN {
#make matrix
   my_matrix <- sparseMatrix(
       i = c(1, 1, 2, 3, 4, 4, 5, 6, 7, 7), 
       j = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 
       x = c(1, 1, 3, 1, 2, 1, 1, 1, 2, 1)
   )
#remove weights
   sparsematrix_rm_weights(my_matrix)
# }

Run the code above in your browser using DataLab