fix: biconnected_components() returns invalid result fields
#2427
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The auto-generated
biconnected_components_impl()was creating duplicate empty fields with dot notation (tree.edges,component.edges,articulation.points) alongside the correct underscore fields from the C layer.Root Cause
The impl function received underscore field names from C but incorrectly accessed them using dot notation:
This created new empty dot fields while leaving the original underscore fields unchanged, resulting in:
Changes
res$tree_edges,res$component_edges,res$articulation_points)Result
All fields now contain properly typed
igraph.vs/igraph.esobjects.Original prompt
This section details on the original issue you should resolve
<issue_title>
biconnected_components()returns invalid result fields</issue_title><issue_description>
biconnected_components()returns a result list with named componentstree_edges,component_edges,articulation_points. These list components have valid values, However, the result also has componentstree.edges,component.edgesandarticulation.points. These are empty.Note that
biconnected_components()is fully auto-generated, but somewhere during auto-generation the_is changed to a., but only in some places, not everywhere.Also notice the function definition:
</issue_description>
Comments on the Issue (you are @copilot in this section)
@ntamas The replacement is done in Stimulus in `src/stimulus/generators/r.py` in the function named `get_r_parameter_name` -- that part of the code is actually replacing underscores with dots. I don't have more time to debug this, but start looking there. @szhorvat This broke between 1.2.11 and 1.3.0. Isn't that when stimulus was separated into a library?This specific function used underscore names in 1.2.11,
res$articulation_pointsThe autogenerated code in 1.3.0 uses a buggy mixture of underscore and dot, and ends up with the mess I showed above. Furthermore, the outputs are no longer a proper vertex/edges sequences.
As Tamás said in chat, we need to decide whether we go with dots or underscores for output parameter names. Input parameters and attributes already use dots, so that's a natural choice, but that would involve a breaking change for
biconnected_components().</comment_new><comment_new>@szhorvat
I would have expected this to be fixable using
but this doesn't disable the
_->.replacement. If the parameters are renamed to anything but the original name, then the replacement is disabled. It would be good to fix this in Stimulus, to allow for special cases when we DON'T want the.-renaming.</comment_new><comment_new>@ntamas
The
_->.replacement is specific to the R code generator and it was there to enforce R's then-preferred dotted notation without having to spell out the alternative names one by one for each argument. Also, this came before we've hadPARAM_NAMES. I wouldn't try to fix the treatment ofPARAM_NAMESvs the replacement, I'd rather prefer first to decide once and for all which of the two formats (dotted or underscored) is preferred in the R interface. If it is the dotted notation, then everything is fine and we don't need any special treatment inPARAM_NAMES. If it is the underscored notation, we need to remove the replacement code and that's all.</comment_new><comment_new>@szhorvat
@krlmlr, the ball's in your court on this one.</comment_new>
<comment_new>@krlmlr
Changing the component names in a back-compatible way seems difficult, I wonder if it's worth the effort.
Just breaking the functionality seems to require a...
biconnected_components()returns invalid result fields #1203✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.