-
-
Notifications
You must be signed in to change notification settings - Fork 206
attr in as_biadjacency_matrix() #1540
Copy link
Copy link
Closed
Description
@szhorvat is this expected:
library("igraph")
#>
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#>
#> decompose, spectrum
#> The following object is masked from 'package:base':
#>
#> union
withr::local_seed(42)
I <- matrix(sample(0:1, 9, replace = TRUE, prob = c(3, 1)), ncol = 3)
g <- graph_from_biadjacency_matrix(I)
E(g)$something <- runif(ecount(g))
as_biadjacency_matrix(g, sparse = TRUE, attr = "something")
#> 3 x 3 sparse Matrix of class "dgTMatrix"
#> 4 5 6
#> 1 0.7050648 0.4577418 .
#> 2 0.7191123 . .
#> 3 . . .
g2 <- graph_from_biadjacency_matrix(I)
E(g2)$something <- letters[1:ecount(g)]
as_biadjacency_matrix(g2, sparse = TRUE, attr = "something")
#> Error in getClass(Class, where = topenv(parent.frame())): "gTMatrix" is not a defined classCreated on 2024-09-30 with reprex v2.1.0
If so, we should add some details to the documentation about what attrcan be depending on sparse/dense, and some argument checks inside the function.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels