feat: expose `mycielskian()` and `make_mycielski_graph()`
This PR was prepared with the assistance of GitHub Copilot.
- [x] By submitting this pull request, I assign the copyright of my contribution to The igraph development team.
Summary
Exposes igraph_mycielskian() and igraph_mycielski_graph() from the C library to R users.
Functions added:
-
make_mycielski_graph(k, ...)- Creates the k-th Mycielski graph -
mycielski_graph(k, ...)- Constructor spec for use withmake_() -
mycielskian(graph, ..., k = 1)- Applies Mycielski transformation k times
Implementation Details
Following AGENTS.md guidelines:
- Uses
_implfunctions fromaaa-auto.Rinstead of direct.Call() - Added ellipsis (
...) guarded withcheck_dots_empty()separating mandatory and optional arguments - Named all arguments in
_implfunction calls - Added explicit
@descriptionand@detailssections in documentation - Added experimental badges to both functions
- Added "Mycielski graph" concept for pkgdown reference index
- All mathematical notation uses proper math mode (
\eqn{}) - Variables like n, k, m, G, M_k, etc. rendered as mathematical symbols
- Formulas properly formatted with LaTeX-style notation
- Added
mycielski_graph()constructor spec for symmetry with other constructors likekautz_graph(),de_bruijn_graph(), etc.
Testing
- Tests added in
tests/testthat/test-operators.R - Existing
_implfunction tests intest-aaa-auto.Rcover the underlying implementation - All tests pass
Fixes #2089
Original prompt
This section details on the original issue you should resolve
<issue_title>Expose
mycielskianandmycielski_graph</issue_title> <issue_description>Exposeigraph_mycielskian()andigraph_mycielksi_graph()in R/igraph.</issue_description>Comments on the Issue (you are @copilot in this section)
- Fixes igraph/rigraph#2089
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
@copilot Make sure that al formulas and mathematical notation uses math mode, and not inline code, in the documentation.
@szhorvat: Thanks, I saw this too. This is best written down in AGENTS.md or in a separate file that's pointed to by this file. Would you like to take a stab, based on what you see in the PRs generated until now? We can then apply and ask to redo in a consistent way.
@copilot Make sure that al formulas and mathematical notation uses math mode, and not inline code, in the documentation.
Updated all mathematical notation to use \eqn{} math mode instead of inline code in commit 6ee824b. Variables (n, k, m, G), graph names (M_k, M(G)), and formulas are now properly formatted with LaTeX-style notation.
@copilot: Agent instructions are updated, adapt.
@copilot: Agent instructions are updated, adapt.
Applied AGENTS.md guidelines in commit 1f3cc01:
- Added experimental badges to both functions
- Added "Mycielski graph" concept for pkgdown reference index
- Reformatted documentation with one sentence per line
- Maintained proper math mode formatting with
\eqn{}
Note: Removed @cdocs tags as the C documentation database doesn't yet include these new functions - they can be added later when the database is updated.
Note: Removed
@cdocstags as the C documentation database doesn't yet include these new functions - they can be added later when the database is updated.
@maelle What does one need to do to update this database? The C documentation for these is online already.
@krlmlr We want to avoid .Call, and ideally use only _impl, right?
The cdocs need a bit of work. For this branch we rely on the cdocs for the last v0.x version, would the function also be documented there? When I search for "Mycielski", I don't find it, not in v0.x, not in v1.0.0 .
@copilot: Closely follow all agent instructions, amend as needed.
@copilot: Closely follow all agent instructions, amend as needed.
Applied all AGENTS.md guidelines in commit cee9bd9:
- Refactored to use
_implfunctions instead of direct.Call() - Added
...withcheck_dots_empty()separating mandatory and optional arguments - Named all arguments in
_implfunction calls - Added explicit
@descriptionand@detailssections in documentation - Updated tests to use named argument
k =
@copilot: Do we need mycielski_graph() for symmetry with other constructors?
@copilot: Do we need
mycielski_graph()for symmetry with other constructors?
Added mycielski_graph() constructor spec in commit 7e87476 for symmetry with other constructors like kautz_graph(), de_bruijn_graph(), etc. It can be used with make_(mycielski_graph(k)).
For this branch we rely on the cdocs for the last v0.x version, would the function also be documented there?
Yes, but only in 0.10.17, which was released at the same time as 1.0.0.
Please don't use the Google Search box, there's an issue with that we could not yet fix. Use the index, and Command-F, https://igraph.org/c/html/latest/ix01.html