Comments (6)
I've narrowed down the issue, there are NA
values being passed on to the intitial
numeric vector of cluster_label_prop()
. When the labels are not fixed this does not seem to be an issue, but if the NA
integer are set as fixed, R crashes.
# R Crashes (as before)
lpa <- cluster_label_prop(g,
weights = E(g)$vrank,
initial = lab.df$int.label,
fixed = lab.df$fixed)
# R does not crash
na.label <- is.na(lab.df$int.label)
lab.df$int.label[ na.label ] <- 99
lpa <- cluster_label_prop(g,
weights = E(g)$vrank,
initial = lab.df$int.label,
fixed = lab.df$fixed)
# R Crashes
# lab.df$fixed[ 1 ] is TRUE
lab.df$int.label[ 1 ] <- NA
lpa <- cluster_label_prop(g,
weights = E(g)$vrank,
initial = lab.df$int.label,
fixed = lab.df$fixed)
from rigraph.
@Antonov548 Can you run this using ASAN and see if it's still present in the dev version (to become 2.0.4)? When not using ASAN, a lack of crash does not indicate that there is no bug (I can't repro it on my machine, but that doesn't mean no bug).
from rigraph.
Is there a good way to get you system log information from the time the crash happens which could help diagnose the problem?
from rigraph.
I'm not sure, I don't think so.
It's good to note that passing NA values to igraph functions is almost never valid (certainly not here). The exceptions are storing attributes (NA values can be stored) and where a NA scalar has special meaning (e.g. weights=NA
).
That said, there should not be a crash.
I believe the major issue here is that the R interface does not do any validation when converting to an integer vector (igraph_vector_int_t
). See:
rigraph/src/rinterface_extra.c
Lines 3380 to 3388 in 128182d
This is related to #1140, but for vectors rather than scalars. I noted it with a yellow mark in #840. Note that doing it for vectors may have a noticeable performance impact.
@krlmlr I would not make this issue block 2.0.4. A proper fix will be very time consuming.
from rigraph.
Agreed, the NA
was actually an error on my side upstream of LPA, but having it take down the whole R session was annoying. Throwing an error if there are NA
in int.label
seems prudent, but if the error is not easily reproducible, then that may cause other errors in systems where it's working.
from rigraph.
Yes, of course this should be fixed. The problem is that the proper fix is time-consuming, and requires a lot of care, as it involves reviewing some of the fundamental glue code between R and C, and not just this single function. This is why I recommended not blocking the next release on this issue.
from rigraph.
Related Issues (20)
- revdeps HOT 13
- V(g) not the same as 1:vcount HOT 5
- Export `.from` etc. with behavior similar to `dplyr::across()` HOT 1
- use lifecyle for layout.fruchterman.reingold()
- Remove/deprecate the functions using constructor_spec()? HOT 1
- deprecate neimode argument in bfs() for good
- `feedback_arc_set()` needs tests
- Add `igraph_feedback_vertex_set()`
- A weights vector in `local_scan`
- TODOs in `rinterface_extra.c`
- TODOs in tests HOT 17
- TODO in `src/igraph_vector.hpp` HOT 2
- TODOs in `socnet.R` HOT 7
- TODO in tkplot
- ensure max.print is used consistently in all of print.R
- Update `is_separator()` docs
- can indexing be made faster HOT 1
- can we remove the "## TODO: speed this up" in make.R?
- Add `igraph_find_cycle()`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rigraph.