While we are at it, can you please also add the following?
Produce an informative error for each of the following invalid or unsupported inputs:
[ ] Both directed=TRUE and bipartite!=FALSE, and both are passed (use missing() to check).
[x] loops=TRUE.
[x] multiple=TRUE.
[x] hyper=TRUE.
[x] numedges is given and is not an integer.
[x] numedges>ndyads.
[x] density is not between 0 and 1 (inclusive).
Also,
[x] If bipartite!=FALSE and directed==TRUE but directed is not passed explicitly (i.e., missing(directed)==TRUE, set directed=FALSE and issue a warning() informing the user and stating that this behaviour may change in the future.
Lastly, implement testthat tests in a file tests/testthat/test-as.network.numeric.R (using networks small enough that they don't take much time).
[x] The above error and warning behaviours (using expect_error() and expect_warning()).
[x] Correct number of edges for directed, undirected, and bipartite networks if numedges is passed, for reasonable numedges.
[x] Correct number of edges for complete graphs (maximum possible numedges) or density==1.
While we are at it, can you please also add the following?
Produce an informative error for each of the following invalid or unsupported inputs:
directed=TRUE
andbipartite!=FALSE
, and both are passed (usemissing()
to check).loops=TRUE
.multiple=TRUE
.hyper=TRUE
.numedges
is given and is not an integer.numedges>ndyads
.density
is not between 0 and 1 (inclusive).Also,
bipartite!=FALSE
anddirected==TRUE
butdirected
is not passed explicitly (i.e.,missing(directed)==TRUE
, setdirected=FALSE
and issue awarning()
informing the user and stating that this behaviour may change in the future.Lastly, implement
testthat
tests in a filetests/testthat/test-as.network.numeric.R
(using networks small enough that they don't take much time).expect_error()
andexpect_warning()
).numedges
is passed, for reasonablenumedges
.numedges
) ordensity==1
.