feat: Add attribute combination support to graph operators#2676
Open
schochastics wants to merge 5 commits into
Open
feat: Add attribute combination support to graph operators#2676schochastics wants to merge 5 commits into
schochastics wants to merge 5 commits into
Conversation
…tion, compose, disjoint_union)
Contributor
Author
|
devtools::document() doesnt work locally for me |
krlmlr
reviewed
Jun 4, 2026
Comment on lines
+1317
to
+1325
| make_named_pair <- function() { | ||
| g1 <- graph_from_literal(A - B, B - C, C - A) | ||
| g2 <- graph_from_literal(A - B, B - C, C - A) | ||
| V(g1)$weight <- c(1, 2, 3) | ||
| V(g2)$weight <- c(10, 20, 30) | ||
| E(g1)$weight <- c(1, 2, 3) | ||
| E(g2)$weight <- c(10, 20, 30) | ||
| list(g1 = g1, g2 = g2) | ||
| } |
Contributor
There was a problem hiding this comment.
Move to helper or a proper R/ function?
krlmlr
reviewed
Jun 4, 2026
| ############# | ||
|
|
||
| igraph.i.attribute.combination <- function(comb) { | ||
| igraph.i.attribute.combination <- function(comb, allow_rename = FALSE) { |
Contributor
There was a problem hiding this comment.
Split into two functions, one for a scalar, and the list function as a simple wrapper?
krlmlr
reviewed
Jun 4, 2026
| default_comb <- if (length(default_idx) > 0) { | ||
| comb[[default_idx[1]]] | ||
| } else { | ||
| "rename" |
Contributor
There was a problem hiding this comment.
Suggested change
| "rename" | |
| # Backward-compatible standard | |
| "rename" |
krlmlr
reviewed
Jun 4, 2026
| #' print_all(g1 %du% g2) | ||
| #' @export | ||
| disjoint_union <- function(...) { | ||
| disjoint_union <- function(..., graph.attr.comb = "rename") { |
Contributor
There was a problem hiding this comment.
Suggested change
| disjoint_union <- function(..., graph.attr.comb = "rename") { | |
| disjoint_union <- function(..., graph_attr_comb = "rename") { |
and clean up edge.attr.comb ? Think harder about naming, but the names already are long enough.
krlmlr
reviewed
Jun 4, 2026
| ################################################################### | ||
|
|
||
| rename.attr.if.needed <- function( | ||
| combine.attrs <- function( |
Contributor
There was a problem hiding this comment.
Keep rename_attr_if_needed() and use it only for those attributes where the action is "rename"?
Contributor
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if cb49b91 is merged into main:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #57