-
-
Notifications
You must be signed in to change notification settings - Fork 206
feat: add make_hex_lattice() and hex_lattice() functions
#2418
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
base: main
Are you sure you want to change the base?
Conversation
Expose igraph_triangular_lattice() as make_hex_lattice() with hex_lattice() constructor spec Co-authored-by: krlmlr <[email protected]>
Co-authored-by: krlmlr <[email protected]>
Co-authored-by: krlmlr <[email protected]>
Co-authored-by: krlmlr <[email protected]>
make_hex_lattice() and hex_lattice() functions
krlmlr
left a comment
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.
@copilot: Use igraph_hexagonal_lattice, not triangular. Merge main and obey updated instructions.
|
@copilot: Merge |
Co-authored-by: krlmlr <[email protected]>
|
@copilot: Merge |
…with correct test expectations Co-authored-by: krlmlr <[email protected]>
|
@copilot: Merge |
…snapshots Co-authored-by: krlmlr <[email protected]>
Completed in acab512. Merged |
…er updated guidelines Co-authored-by: krlmlr <[email protected]>
|
@copilot: Prefer |
…x_lattice() Co-authored-by: krlmlr <[email protected]>
Completed in 7f33188. Updated function signatures to use explicit arguments with ellipsis before optional parameters. Changed |
| #' @rdname make_hex_lattice | ||
| #' @export | ||
| hex_lattice <- function(dims, ..., directed = FALSE, mutual = FALSE) { | ||
| constructor_spec(make_hex_lattice, dims = dims, directed = directed, mutual = mutual) |
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.
| constructor_spec(make_hex_lattice, dims = dims, directed = directed, mutual = mutual) | |
| check_dots_empty() | |
| constructor_spec(make_hex_lattice, dims = dims, directed = directed, mutual = mutual) |
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.
Completed in a5e6b2f. Added check_dots_empty() to hex_lattice() as suggested.
krlmlr
left a comment
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.
@copilot: See review, use @inheritParams, specify GATTR in functions-R.yaml .
… dimvector for attr name Co-authored-by: krlmlr <[email protected]>
|
@szhorvat: Copilot complains that
What's the process here? |
Implementation Complete ✅
Successfully implemented
make_hex_lattice()andhex_lattice()functions usingigraph_hexagonal_lattice().Changes Made
mainbranch (latest updates)AGENTS.mdinstructionsset_graph_attr()check_dots_empty()to both functions for proper validationdimvectorfor attribute name to match C function parameter and GATTR specificationKey Documentation Fix
Before: The documentation incorrectly stated that hexagonal lattice is "also sometimes referred to as a triangular lattice"
After: Corrected documentation clarifies that:
make_hex_lattice()implements the hexagonal lattice (degree 3 vertices)igraph_triangular_lattice()in the C libraryFunction Signature Updates
Updated signatures following tidyverse design guide:
This follows the pattern where:
...comes before optional arguments (for future extensibility)check_dots_empty()validates no unexpected arguments are passed...GATTR Specification
Added GATTR specification in
tools/stimulus/functions-R.yaml:This documents the intended attribute handling. When
igraph_hexagonal_latticeis added to the base C interface definitions, the function can be auto-generated with proper GATTR support.Implementation Summary
This PR exposes the
igraph_hexagonal_lattice()C function through two new R functions:make_hex_lattice(): Creates hexagonal latticeshexagonal_lattice_impl()which calls Cigraph_hexagonal_lattice()hex_lattice(): Constructor spec formake_()infrastructureComprehensive tests with correct expectations
Function Usage
All functionality works correctly and follows updated code style guidelines!
Original prompt
make_hex_lattice()#1404💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.