rigraph icon indicating copy to clipboard operation
rigraph copied to clipboard

feat: expose `mycielskian()` and `make_mycielski_graph()`

Open Copilot opened this issue 2 months ago • 12 comments

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 with make_()
  • mycielskian(graph, ..., k = 1) - Applies Mycielski transformation k times

Implementation Details

Following AGENTS.md guidelines:

  • Uses _impl functions from aaa-auto.R instead of direct .Call()
  • Added ellipsis (...) guarded with check_dots_empty() separating mandatory and optional arguments
  • Named all arguments in _impl function calls
  • Added explicit @description and @details sections 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 like kautz_graph(), de_bruijn_graph(), etc.

Testing

  • Tests added in tests/testthat/test-operators.R
  • Existing _impl function tests in test-aaa-auto.R cover the underlying implementation
  • All tests pass

Fixes #2089

Original prompt

This section details on the original issue you should resolve

<issue_title>Expose mycielskian and mycielski_graph</issue_title> <issue_description>Expose igraph_mycielskian() and igraph_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 avatar Oct 26 '25 10:10 Copilot

@copilot Make sure that al formulas and mathematical notation uses math mode, and not inline code, in the documentation.

szhorvat avatar Oct 26 '25 12:10 szhorvat

@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.

krlmlr avatar Oct 26 '25 12:10 krlmlr

@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 avatar Oct 26 '25 12:10 Copilot

@copilot: Agent instructions are updated, adapt.

krlmlr avatar Oct 26 '25 17:10 krlmlr

@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.

Copilot avatar Oct 26 '25 18:10 Copilot

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.

@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?

szhorvat avatar Nov 30 '25 09:11 szhorvat

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 .

krlmlr avatar Nov 30 '25 20:11 krlmlr

@copilot: Closely follow all agent instructions, amend as needed.

krlmlr avatar Nov 30 '25 20:11 krlmlr

@copilot: Closely follow all agent instructions, amend as needed.

Applied all AGENTS.md guidelines in commit cee9bd9:

  • Refactored to use _impl functions instead of direct .Call()
  • Added ... with check_dots_empty() separating mandatory and optional arguments
  • Named all arguments in _impl function calls
  • Added explicit @description and @details sections in documentation
  • Updated tests to use named argument k =

Copilot avatar Nov 30 '25 20:11 Copilot

@copilot: Do we need mycielski_graph() for symmetry with other constructors?

krlmlr avatar Nov 30 '25 20:11 krlmlr

@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)).

Copilot avatar Nov 30 '25 20:11 Copilot

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

szhorvat avatar Nov 30 '25 20:11 szhorvat