Issue Title: ensure_no_na causes memory overflow for large sparse matrices when mode = "lower" or "upper"
Description:
Hello
When passing a large sparse matrix (class dgCMatrix) to graph_from_adjacency_matrix() with mode = "lower", the function fails with a memory allocation error:
r
igraph:::ensure_no_na(object, "adjacency matrix", 'lower')
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'i' in selecting a method for function '[':
cannot allocate vector of size 5426.7 Gb
To reproduce
library(Matrix)
library(igraph)
Create a large sparse matrix (simulated)
dim_size <- 1206945
sparse_mat <- rsparsematrix(dim_size, dim_size, density = 1e-6)
This fails with memory error
graph <- graph_from_adjacency_matrix(sparse_mat,
mode = "lower",
diag = FALSE)
System information
No response
Issue Title: ensure_no_na causes memory overflow for large sparse matrices when mode = "lower" or "upper"
Description:
Hello
When passing a large sparse matrix (class dgCMatrix) to graph_from_adjacency_matrix() with mode = "lower", the function fails with a memory allocation error:
r
To reproduce
library(Matrix)
library(igraph)
Create a large sparse matrix (simulated)
dim_size <- 1206945
sparse_mat <- rsparsematrix(dim_size, dim_size, density = 1e-6)
This fails with memory error
graph <- graph_from_adjacency_matrix(sparse_mat,
mode = "lower",
diag = FALSE)
System information
No response