network
network copied to clipboard
convention for `class` of network size attribute: `integer` or `numeric`?
It seems this is initialized to numeric
by network.initialize
, e.g.
require(network)
nw <- network.initialize(100000L, bip = 60000L, directed = FALSE)
class(network.size(nw))
# [1] "numeric"
network.dyadcount(nw)
# [1] 2.4e+09
However, add.vertices
and delete.vertices
appear to change it to integer
, which can e.g. lead to network.dyadcount
overflowing:
require(network)
nw <- network.initialize(100000L, bip = 60000L, directed = FALSE)
delete.vertices(nw, 1)
class(network.size(nw))
# [1] "integer"
network.dyadcount(nw)
# [1] NA
# Warning message:
# In nactor * nevent : NAs produced by integer overflow
require(network)
nw <- network.initialize(100000L, bip = 60000L, directed = FALSE)
add.vertices(nw, 1)
class(network.size(nw))
# [1] "integer"
network.dyadcount(nw)
# [1] NA
# Warning message:
# In nactor * nevent : NAs produced by integer overflow
Assuming our networks won't exceed 2 billion nodes, we should be fine to standardise on integer
; but in dyad count calculation we should, indeed, upcast to numeric
.