Conversation
|
I initiated a revdepcheck with |
Codecov Report
@@ Coverage Diff @@
## main #633 +/- ##
=======================================
Coverage 62.69% 62.70%
=======================================
Files 73 73
Lines 21536 21571 +35
=======================================
+ Hits 13502 13526 +24
- Misses 8034 8045 +11
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
revdepcheck results are slightly devastating. Need to take a closer look. |
Only 10/755 = 1.3% failed :-) Devastating is a bit of an overstatement, no? |
|
@tilltnet @damianobaldan: I believe the failures in egor and riverconn are false positives, see https://github.com/igraph/rigraph/pull/633/files#diff-bbdda7f28391ee0ec001638e5603609582124345e0d65ebd4747cc592f9bd56d .
Can you please checkout this branch, run |
3c7b9e1 to
16b6a78
Compare
|
Checking again the 19 failing packages in strict mode. |
16b6a78 to
b99ff32
Compare
|
@zpneal @martirm @DominikRafacz @gemtc @gertvv @GrossSBM @MarcOhlmann @jefferis @guido-s @grunwaldlab @damianobaldan @schochastics: The current version of this PR implements stricter rules for assigning attributes to vertices and edges. To my knowledge, you are maintaining a package that fails to pass its checks with these new rules. With the current CRAN version, it's possible to assign a vector of length 2 as a vertex attribute to a graph with 10 vertices, via recycling. Similarly, for edges. This also means that you can assign a vector of length 3 as a vertex attribute to the same graph, which is most likely an error. See the following example. library(igraph, warn.conflicts = FALSE)
g <- make_ring(10)
# works
V(g)$foo <- 1
V(g)$foo <- 1:10
E(g)$foo <- 1
E(g)$foo <- 1:10
# may be a mistake
V(g)$bar <- 1:2
V(g)$bar <- 1:3
#> Warning in value_in[seq_along(value_in)] <- value: number of items to replace is
#> not a multiple of replacement length
E(g)$bar <- 1:2
E(g)$bar <- 1:3
#> Warning in value_in[seq_along(value_in)] <- value: number of items to replace is
#> not a multiple of replacement lengthCreated on 2023-01-16 with reprex v2.0.2 The new rules require that attribute vectors have length 1 or the same length as the number of vertices or edges. I wonder if there are genuine use cases for this recycling of attributes, or if the new strict rules have uncovered a hidden problem in your code. See the below example for symptoms. library(igraph, warn.conflicts = FALSE)
g <- make_ring(10)
# works
V(g)$foo <- 1
V(g)$foo <- 1:10
E(g)$foo <- 1
E(g)$foo <- 1:10
# fails
V(g)$bar <- 1:2
#> Error in i_set_vertex_attr(x, attr(value, "name"), index = value, value = attr(value, : strict recycling (1)
V(g)$bar <- 1:3
#> Error in i_set_vertex_attr(x, attr(value, "name"), index = value, value = attr(value, : strict recycling (1)
E(g)$bar <- 1:2
#> Error in i_set_edge_attr(x, attr(value, "name"), index = value, value = attr(value, : strict recycling (2)
E(g)$bar <- 1:3
#> Error in i_set_edge_attr(x, attr(value, "name"), index = value, value = attr(value, : strict recycling (2)Created on 2023-01-16 with reprex v2.0.2 Can you please run |
|
See https://github.com/igraph/rigraph/pull/633/files#diff-bbdda7f28391ee0ec001638e5603609582124345e0d65ebd4747cc592f9bd56d for a description of the problems we found, you may need to click "load diff". Packages not found on GitHub: Diderot, mstknnclust. |
46b8ca9 to
af6d37b
Compare
|
This seems like a sensible choice. I fixed my example error which was not a legitimate use of recycling but an actual copy and paste issue schochastics/signnet@8ad0ea7 |
|
thanks, fixed, there was an error in the example.
Damiano
Il giorno dom 15 gen 2023 alle ore 21:15 Kirill Müller <
***@***.***> ha scritto:
… @tilltnet <https://github.com/tilltnet> @damianobaldan
<https://github.com/damianobaldan>: I believe the failures in egor and
riverconn are false positives, see
https://github.com/igraph/rigraph/pull/633/files#diff-bbdda7f28391ee0ec001638e5603609582124345e0d65ebd4747cc592f9bd56d
.
- egor: creating an empty graph with graph.data.frame() now creates
attributes for all columns, instead of leaving them unset. The test is too
strict, if you change it to assert that the length of the attribute is
zero, it will work for both old and new igraph versions
- riverconn: the example doesn't make sense to me, it checks the
non-existing attribute E(g)$id_barrier right after the graph is created
Can you please checkout this branch, run make , then R CMD INSTALL . ,
and then run your tests/examples to confirm?
—
Reply to this email directly, view it on GitHub
<#633 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AW55PN57AM2XGTOWBJ4AY3TWSRLFLANCNFSM6AAAAAAT3YQDS4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Running |
|
You might need to install the experimental Alternatively, use (Note that I'm adding |
|
Thanks @ntamas for the link. I tried installing experimental Apologies - I have limited experience with compilers and working in the Mac terminal. |
|
@krlmlr I've fixed the error in The error in |
|
Thanks @krlmlr! In my case the error now happens because it is no longer possible to add a null attribute (I have code which either adds the correct number of edge attributes or none by setting NULL). Obviously it's not the end of the world to have to check if attributes are empty and adjust the call accordingly but I wanted to check that this was a conscious design decision? Used to work with igraph 1.3.5: Now errors with this branch: Now I would have to do: obviously if there are multiple attributes to add it gets more complicated and I end up having to do |
|
Thanks, this is very helpful. We certainly can leave such |
af6d37b to
61f6db9
Compare
|
Restarted revdepchecks for broken packages. |
|
@krlmlr thanks for the change in e89ab9e. Now all but one of my tests pass. The last one was actually testing for exactly this kind of attribute length issue, so I guess I would need to change the test expect_warning(testg <- as.ngraph(testd, graph.attributes = gatts,
vertex.attributes=list(X=testd$X[-1])))to something like: # nb previously attribute lengths gave a mismatch
if(igraph::igraph_version()>=numeric_version("1.3.5.9098"))
expect_error(testg <- as.ngraph(testd, graph.attributes = gatts,
vertex.attributes=list(X=testd$X[-1])))
else
expect_warning(testg <- as.ngraph(testd, graph.attributes = gatts,
vertex.attributes=list(X=testd$X[-1])))thoughts? |
e89ab9e to
cba5bf9
Compare
|
The mstknnclust error seems to come from here: https://github.com/cran/mstknnclust/blob/master/vignettes/guide.Rmd#L104 We need to notify the maintainer via e-mail. Other than that, are we okay with this breaking change? |
|
Yes I am. |
|
@DominikRafacz @tilltnet @Demiperimetre @guido-s @jmanitz @grunwaldlab: This breaks checks in packages you maintain, see #633 (comment) for details. If you think this is incorrect behavior on our end, please comment here (while this PR is open) or file a new issue. |
|
New error message format:
|
|
LGTM. Shall I merge the revdepcheck results into |
|
@krlmlr I've just run into a new error whose source I haven't tracked down. The gist of it is that I was replacing a subset of the weight attributes on edges of a graph (defined by a single path across the graph) with 0. The result is that with igraph from this PR I end up with the new graph with weight attributes having the length of the subset I just changed ie all the other edges lose their weights. |
|
@krlmlr the bug is almost certainly introduced in this PR as |
|
@krlmlr with with Notice how vs Somewhere the partial replacement is being used to replace the complete set of edge attributes. |
|
The bug is introduced by e0536d1 and I assume that there is a logic error here: I don't know what i.e. a path is considered complete when I hope this helps suggest an appropriate fix @krlmlr. Thanks to the whole team for your continued work on this vital and valuable package! |
|
Thanks, on it. |
|
Fixed, restarted revdepchecks for the broken packages. I propose to keep revdep results in version control. |
|
@wael-sadek: Can you please take a look why the fledge workflow has run for this PR? |
|
@DominikRafacz @tilltnet @Demiperimetre @guido-s @jmanitz @grunwaldlab: This still breaks checks in packages you maintain, see #633 (comment) for details. If you think this is incorrect behavior on our end, please comment here (while this PR is open) or file a new issue. Thanks! |
|
You can find mstknn package here https://github.com/cran/mstknnclust |
Closes #466.
This needs a full revdepcheck in all cases, and a cleanup (decide on
ATTRIBUTE_STRICT_RECYCLING).