-
-
Notifications
You must be signed in to change notification settings - Fork 206
refactor: integrate callback into motifs() function
#2544
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
Conversation
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
motifs() function
R/motifs.R
Outdated
| #' | ||
| #' This function searches for motifs in a graph and calls a user-provided | ||
| #' callback function for each motif found. | ||
| #' @description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop the function entirely, not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 1130037. The motifs_randesu_callback() function has been removed entirely. The callback functionality is now only available through the motifs(callback = ...) parameter.
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the motif search callback functionality by integrating it as an optional parameter into the existing motifs() function, following the pattern established by cluster_leading_eigen(). This simplifies the API by removing the need for a separate exported function.
Changes:
- Integrated callback functionality into
motifs()as an optional parameter, maintaining backward compatibility - Removed
motifs_randesu_callback()function (no longer exported) - Updated all tests and documentation to use the new
motifs(callback = ...)syntax
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| R/motifs.R | Added callback parameter to motifs() function; removed standalone motifs_randesu_callback() function; fixed error message formatting |
| tests/testthat/test-motifs.R | Updated all callback tests to use new motifs(callback = ...) API |
| tests/testthat/_snaps/motifs.md | Updated snapshot test header to reflect new API naming |
| man/motifs.Rd | Added callback parameter documentation and example; improved text clarity ("3 to 6" instead of "3-6") |
| man/motifs_randesu_callback.Rd | Removed documentation file for deleted function |
| man/sample_motifs.Rd | Removed reference to deleted motifs_randesu_callback() function |
| man/graph.motifs.Rd | Updated text clarity ("3 to 6" instead of "3-6") |
| man/dyad_census.Rd | Removed reference to deleted motifs_randesu_callback() function |
| man/count_motifs.Rd | Removed reference to deleted motifs_randesu_callback() function |
| NAMESPACE | Removed export of motifs_randesu_callback() |
| .gitignore | Minor formatting fix (added leading slash for consistency) |
Integrates callback functionality into
motifs()as an optional parameter instead of exporting a separate function. Aligns API withcluster_leading_eigen()pattern.Changes
motifs()function: Added optionalcallbackparametercallback = NULL(existing behavior)motifs_randesu_callback_closure_impl()and returnsNULLinvisibly when callback providedmotifs_randesu_callback()function: Removed entirely (not exported)Tests: Updated to use
motifs(callback = ...)syntaxDocumentation:
Example
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.