Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convention for class of network size attribute: integer or numeric? #76

Open
chad-klumb opened this issue Apr 21, 2022 · 1 comment
Open

Comments

@chad-klumb
Copy link
Contributor

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
@krivit
Copy link
Member

krivit commented Apr 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants