fix: Correct the motifs() callback example and test the callback path#2445
motifs() callback example and test the callback path#2445Conversation
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
…emory bug Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
igraph_motifs_randesu_callback() to R for efficient motif sampling
|
@copilot: Merge |
Merged Regarding using Stimulus for autogeneration: I've reviewed the Stimulus configuration and existing callback function patterns (e.g., The current implementation in Could you clarify the approach you'd like me to take? Should I:
|
|
@copilot: Patch the local copy of Stimulus as you see fit to open the road for generated callbacks. |
…NORE flags Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Added Stimulus configuration for callback support in commit a6da008. Following the established pattern in rigraph, callback functions are marked with Added:
The types can be extended in the future to support additional callback functions. |
Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Keep both callback exposures: main's closure-based motifs(callback =) machinery and this branch's standalone motifs_randesu_callback() with its extra-argument passthrough. - src/cpp11.cpp: keep main's registration table and add this branch's R_igraph_motifs_randesu_callback extern + entry. - src/rinterface_extra.c: port this branch's handler and wrapper onto main, adapting to the renamed helpers (Rz_SEXP_to_igraph, Rz_SEXP_to_vector, Ry_igraph_vector_int_to_SEXPp1, Rx_igraph_safe_eval_in_env, Rx_igraph_handle_safe_eval_result_in_env). - tests/testthat/test-motifs.R: keep both sides' appended tests. - man/: regenerate the graph-motifs family pages with roxygen2. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if c65fe97 is merged into main:
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX
igraph_motifs_randesu_callback() to R for efficient motif samplingmotifs() callback example and test the callback path
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if ca23661 is merged into main:
|
Status: original goal superseded — PR reduced to the additive remainder
This PR originally exposed
igraph_motifs_randesu_callback()(requested in #798)
as a separate
motifs_randesu_callback()functionwith a hand-written
.Call()bridge insrc/rinterface_extra.c.mainhas since shipped the same capability asmotifs(callback = ),generated through the Stimulus callback-closure pattern
(
igraph_motifs_randesu_callback_closureintools/stimulus/functions-R.yaml,bridged in
src/rcallback.c),completing the autogeneration route laid out in #2464.
The branch's exposure duplicated that capability without adding value:
its only API differences were an
extrapass-through argument,which R closures make unnecessary,
and a
(graph, motif, extra)callback signaturethat diverges from the repo's
(vids, isoclass)closure convention.The duplicate wrapper, the hand-written C bridge and its registration,
the extra Stimulus type entries,
and a duplicate
functions-R.yamlkeyintroduced by the conflict resolution
have therefore been removed;
the branch now carries only what is genuinely additive:
motifs()example claimed to stopafter five motifs but returned
count < 5;because the callback stops the search by returning
TRUE,it actually stopped at the first motif.
It now returns
count >= 5.motifs_randesu_callback_closure_impl()with a full argument set,
deterministic isomorphism-class tallies
checked against
motifs()andcount_motifs(),and order-exact agreement with the exported
motifs(callback = )path.interaction of
cut.probwithcallback.The capability requested in #798 is fully available on
mainvia
motifs(callback = ),so #798 can be closed independently of this PR.
If the maintainer considers the example fix and tests
not worth a separate PR,
this PR can be closed without losing any functionality.