-
-
Notifications
You must be signed in to change notification settings - Fork 208
feat: accept two-column matrices/data frames in edge functions (#1827) #2700
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?
Changes from all commits
713cdd8
1a667ac
f0774f8
be3d283
f8953c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1748,7 +1748,7 @@ graph_from_data_frame <- function(d, directed = TRUE, vertices = NULL) { | |||||
| } | ||||||
|
|
||||||
| # add the edges | ||||||
| g <- add_edges(g, edges, attr = attrs) | ||||||
| g <- add_edges(g, c(edges), attr = attrs) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment, or:
Suggested change
with
or row_major_to_vertex_pairs <- function(x) c(x) |
||||||
| g | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -1800,7 +1800,7 @@ graph_from_edgelist <- function(el, directed = TRUE) { | |||||
| V(res)$name <- names | ||||||
| } else { | ||||||
| ## normal edge list | ||||||
| res <- make_graph(t(el), directed = directed) | ||||||
| res <- make_graph(c(t(el)), directed = directed) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -521,7 +521,7 @@ expand.grid.unordered <- function(i, j, loops = FALSE, directed = FALSE) { | |||||
| ## Addition or update of an attribute (or both) | ||||||
| ids <- get_edge_ids(x, c(rbind(from, to))) | ||||||
| if (any(ids == 0)) { | ||||||
| x <- add_edges(x, rbind(from[ids == 0], to[ids == 0])) | ||||||
| x <- add_edges(x, c(rbind(from[ids == 0], to[ids == 0]))) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| if (!is.null(attr)) { | ||||||
| ids <- get_edge_ids(x, c(rbind(from, to))) | ||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Would that work?