Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Adapt handling of optional parameters to interface definition changes in the C core #1567

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

szhorvat
Copy link
Member

This PR contains two changes:

Both PRs should be merged at the same time.

There is some duplicate NULL-check ugliness that is not harmful, but should be cleaned up. I think this needs to be fixed directly in Stimulus. Can you help with this @Antonov548 ? Example: (Rf_isNull(weights) ? 0 : (Rf_isNull(weights) ? NULL : &c_weights))

I'm marking this as draft so it doesn't get accidentally merged before we all agree, but from my side it's good to go.

Copy link
Contributor

aviator-app bot commented Oct 31, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This pull request is currently open (not queued).

How to merge

To merge this PR, comment /aviator merge or add the mergequeue label.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

@szhorvat
Copy link
Member Author

szhorvat commented Oct 31, 2024

The CI failures are due to the issue fixed in #1565 UPDATE: use #1568 instead. I'll rebase this once that PR is merged.

@szhorvat szhorvat marked this pull request as ready for review October 31, 2024 22:37
@szhorvat
Copy link
Member Author

szhorvat commented Oct 31, 2024

There is some duplicate NULL-check ugliness that is not harmful, but should be cleaned up. I think this needs to be fixed directly in Stimulus. Can you help with this @Antonov548 ? Example: (Rf_isNull(weights) ? 0 : (Rf_isNull(weights) ? NULL : &c_weights))

I was wrong, this needed to be fixed in the yaml interface file, and is now fixed.

I think this is good to go.

Since this is a big change, there is some risk and revdepchecks are in order. There are no functional changes, but there may be bugs.

@szhorvat
Copy link
Member Author

szhorvat commented Nov 3, 2024

#1569 shows that tests will pass after merging #1568.

@szhorvat szhorvat changed the title Adapt handling of optional paramters to interface definition changes in the C core Adapt handling of optional parameters to interface definition changes in the C core Nov 4, 2024
@szhorvat
Copy link
Member Author

szhorvat commented Nov 5, 2024

The C side PR was merged, which means that this also needs to be merged. It is now updated to what is likely to become C/igraph 0.10.14.

I'd like to have this merged soon as it is a blocker for further improvements I want to make.

Thus, merge #1568, then merge this, then ping me.

@krlmlr
Copy link
Contributor

krlmlr commented Nov 7, 2024

CI/CD is failing here, https://github.com/igraph/rigraph/actions/runs/11681694081/job/32527681296?pr=1567#step:9:184 :

  Running examples in ‘igraph-Ex.R’ failed
  The error most likely occurred in:
  
  > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
  > ### Name: count_motifs
  > ### Title: Graph motifs
  > ### Aliases: count_motifs
  > 
  > ### ** Examples
  > 
  > g <- sample_pa(100)
  > motifs(g, 3)
   [1]  NA  NA 218  NA  84   0   0   0   0   0   0   0   0   0   0   0
  > count_motifs(g, 3)
  [1] 302
  > sample_motifs(g, 3)
  Error in sample_motifs(g, 3) : 
    At vendor/cigraph/src/misc/motifs.c:604 : The number of vertices to use as a sample for motif count estimation must be at least one, got 0. Invalid value
  Execution halted

Haven't looked closer, but is this anticipated?

@krlmlr krlmlr changed the title Adapt handling of optional parameters to interface definition changes in the C core chore: Adapt handling of optional parameters to interface definition changes in the C core Nov 7, 2024
@szhorvat
Copy link
Member Author

szhorvat commented Nov 7, 2024

That's fixed in #1568, which replaces your #1565. Merge #1568 first and rebase.

@krlmlr krlmlr force-pushed the refactor/clean-up-OPTIONAL branch from 5d7abb4 to 34bcf0c Compare November 7, 2024 10:26
@krlmlr
Copy link
Contributor

krlmlr commented Nov 7, 2024

I stacked and will review later today.

@krlmlr krlmlr force-pushed the refactor/clean-up-OPTIONAL branch from 34bcf0c to 2bce24f Compare November 7, 2024 13:24
@szhorvat
Copy link
Member Author

szhorvat commented Nov 7, 2024

C core now updated to the very latest. This is basically at the 0.10.15 C release.

Copy link
Contributor

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll split this PR. Do I understand correctly that the CRAN failure is fixed with #1568 and that this could wait until after the CRAN release?

R/aaa-auto.R Outdated Show resolved Hide resolved
tools/stimulus/functions-R.yaml Show resolved Hide resolved
…rated code and remove support for deprecated array3 type
chore: fix some spelling mistakes
refactor: minor readability cleanup in igraph_decompose()
doc: more documentation improvements
doc: several documentation improvements and cross-referencing
chore: fix typo in error message
docs: community_optimal_modulairty() does support directed graphs
chore: do not warn about unknown warning options with legacy Intel compiler
fix: validate sample size in igraph_motifs_randesu_estimate()
chore: fix typo in comment
fix: some BIPARTITE_TYPES parameters were incorrectly marked as optional
refactor: use OPTIONAL instead of =NULL in interfaces
refactor: minor readability cleanup in matching functions
fix: `igraph_bipartite_projection_size()` now validates the bipartite `types` vector
fix: some weights parameters were incorrectly marked as OPTIONAL in functions.yaml
fix: mark some optional weight parameters as OPTIONAL in functions.yaml
fix: type -> types in is_bipartite interface
…n_size()`

This parameter is optional in R, but not in C. Therefore the C interface definition doesn't provide a default or OPTIONAL marker.
interface: add more missing OPTIONAL markers
These checks are added automatically by Stimulus for OPTIONAL parameters
interface: even more missing OPTIONAL markers
chore: trim trailing whitespace in interface file
interface: add missing interface for igraph_get_isomorphisms_vf2_callback()
interface: mark all callback extra parameters and some callback functions as optional
interface: add default parameter values for fundamental_cycles() and minimum_cycle_basis()
interface: even more missing OPTIONAL markers
interface: add more missing OPTIONAL markers
fix: some weights parameters were incorrectly marked as OPTIONAL in functions.yaml
fix: mark some optional weight parameters as OPTIONAL in functions.yaml
fix: type -> types in is_bipartite interface
fix: some BIPARTITE_TYPES parameters were incorrectly marked as optional
refactor: use OPTIONAL instead of =NULL in interfaces
feat: functionality for listing all simple cycles
interface: default OUT mode for igraph_find_cycle()
refactor: better error reporting for igraph_find_cycle()
chore: some copyright header cleanup in public headers
refactor: minor readability improvements
fix: add some missing IGRAPH_CHECKs
…ycles_callback()`

as the framework for handling callback functions is not yet present
chore: updated changelog
chore: updated changelog
chore: run pre-commit hooks
chore: bump VERSION property in shared library
fix: fix self-loops handling during simple cycle detection, closes igraph/igraph#2692
Revert "fix: temporary fix for simple cycle search mishandling self-loops, ref igraph/igraph#2692"
fix: temporary fix for simple cycle search mishandling self-loops, ref igraph/igraph#2692
test: minimum cycle length for igraph_simple_cycles()
refactor: do not use vector_get() in simple cycle finder
refactor: cleaner parameter ordering in igraph_i_simple_cycles_circuit()
refactor: support specifying a minimum cycle length in `igraph_simple_cycles()`
interface: loops=True default for igraph_degree()
chore: updated contributors list
… widest path functions

This parameter is not optional in C, but it still needs a default in R to signify that weights should be taken from attributes.
@szhorvat szhorvat force-pushed the refactor/clean-up-OPTIONAL branch from c1d0791 to 305bc33 Compare November 18, 2024 09:19
@szhorvat
Copy link
Member Author

szhorvat commented Nov 20, 2024

I'll split this PR. Do I understand correctly that the CRAN failure is fixed with #1568 and that this could wait until after the CRAN release?

Somehow I missed this comment.

Yes, this is correct.

I still suggest including this in the release, since it's not possible to pick up the latest C core fixes without it. IMO splitting it up is not the best use of time when we are resource-constrained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants