0

As most of you know, Igraph gives error when weight values are not positive, so even when they are "0".
The error is this one:

Weight vector must be positive. Invalid value

I've seen other questions on Stack and answers suggests to change the value from 0 to, for example, 0.001 or, anyway, solve the problem by changing the value.
Assuming that I need the values to be 0 for statistical purposes, are there any other solutions?

  • Remove the nodes entirely? – Allan Cameron May 16 '23 at 09:14
  • Statistically speaking, you can't just remove nodes from the whole network just because you don't like 0s – Antonio Alaia May 16 '23 at 09:19
  • This cannot be answered without knowing what you are doing precisely. It is not correct to say that "Igraph gives error when weight values are not positive". What weights are allowed differs from function to function. Whether adding a tiny value to zero would be acceptable also depends on what function you are using. When zero is disallowed, there is usually a reason for that, and using tiny values may still cause problems. Please update the question is show what you are doing exactly. – Szabolcs May 16 '23 at 10:08
  • Regarding the terminology, "positive" means `> 0`, "non-negative" means `>= 0`. These are customary in mathematics, and igraph uses these consistently. – Szabolcs May 16 '23 at 10:09
  • @AllanCameron You meant "remove the zero-weight edges", not nodes, right? That is indeed a workable solution in many, but not all cases. But again, this can't be answered without knowing specifics. – Szabolcs May 16 '23 at 10:12
  • @Szabolcs yes, exactly. Need to know the context otherwise we can't answer. – Allan Cameron May 16 '23 at 10:20
  • An edge with weight zero is a witch. – clp May 16 '23 at 20:05
  • I grepped the source code and it seems that this specific message is issued only when computing betweenness or closeness, where it is a bit unusual to have a weight of zero, since the weight represents a distance. How do you end up with a weight of zero? – Szabolcs May 17 '23 at 11:06

0 Answers0