Skip to content

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

@chad-klumb

Description

@chad-klumb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions