The issue is rooted in the degree and strength combination force by the default value alpha = 1, though any alpha bigger than zero has the same effect.
The formula computes the ratio strength/degree that, for some nodes, is 0 / 0 = NaN. Additionally, the default is normalization, then the maximum of the vector reproduces the NaNs for all the nodes.
To Reproduce
library(manynet)
#> Warning: package 'manynet' was built under R version 4.3.3
#> Registered S3 method overwritten by 'manynet':
#> method from
#> print.tbl_graph tidygraph
net0 <- matrix(
c(
0, 0, 0, 2, 0,
0, 0, 4, 0, 0,
0, 4, 0, 0, 0,
2, 0, 0, 0, 0,
0, 0, 0, 0, 0
),
nrow = 5, ncol = 5,
dimnames = list(letters[seq(5)], letters[seq(5)])
)
netmn <- as_igraph(net0)
node_degree(netmn, normalized = TRUE)
#> a b c d e
#> 1 NaN NaN NaN NaN NaN
Describe the bug
The issue is rooted in the degree and strength combination force by the default value
alpha = 1
, though any alpha bigger than zero has the same effect. The formula computes the ratio strength/degree that, for some nodes, is 0 / 0 = NaN. Additionally, the default is normalization, then the maximum of the vector reproduces the NaNs for all the nodes.To Reproduce
Created on 2024-09-04 with reprex v2.1.1
Provide system information
Expected behavior I don't know.