-
-
Notifications
You must be signed in to change notification settings - Fork 208
Replace .Call() expressions with _impl functions and add explanatory comments
#2562
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 20 commits
3a9ed79
3937dfc
a85a698
330f326
5c6041f
483a118
08ff3d5
86f4d82
d2302de
05fcfa1
085591d
d7c4ce7
c4ab986
31579a3
a524504
474b71e
1dc318e
4f103aa
318a0f5
366a715
0d52819
ef518a7
4c302a8
3fa66f7
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 |
|---|---|---|
|
|
@@ -325,7 +325,7 @@ max_cliques <- function( | |
| tmpfile <- FALSE | ||
| } | ||
| on.exit(.Call(Rx_igraph_finalizer)) | ||
| res <- .Call( | ||
| res <- .Call( # maximal_cliques_file_impl doesn't support subset | ||
| Rx_igraph_maximal_cliques_file, | ||
| graph, | ||
| subset, | ||
|
|
@@ -350,7 +350,7 @@ max_cliques <- function( | |
| } | ||
|
|
||
| on.exit(.Call(Rx_igraph_finalizer)) | ||
| res <- .Call( | ||
| res <- .Call( # maximal_cliques_impl doesn't support subset | ||
|
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. Which
Contributor
Author
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. Updated in 0d52819: |
||
| Rx_igraph_maximal_cliques, | ||
| graph, | ||
| subset_arg, | ||
|
|
@@ -398,14 +398,21 @@ count_max_cliques <- function(graph, min = NULL, max = NULL, subset = NULL) { | |
| max <- as.numeric(max) | ||
|
|
||
| if (!is.null(subset)) { | ||
| subset <- as.numeric(as_igraph_vs(graph, subset) - 1) | ||
| # Use maximal_cliques_subset_impl when subset is provided | ||
| maximal_cliques_subset_impl( | ||
| graph = graph, | ||
| subset = subset, | ||
| min_size = min, | ||
| max_size = max, | ||
| details = TRUE | ||
| )$no | ||
| } else { | ||
| maximal_cliques_count_impl( | ||
| graph = graph, | ||
| min_size = min, | ||
| max_size = max | ||
| ) | ||
| } | ||
|
|
||
| on.exit(.Call(Rx_igraph_finalizer)) | ||
| # Function call | ||
| res <- .Call(Rx_igraph_maximal_cliques_count, graph, subset, min, max) | ||
|
|
||
| res | ||
| } | ||
|
|
||
| #' @rdname cliques | ||
|
|
@@ -568,30 +575,11 @@ weighted_clique_num <- function(graph, vertex.weights = NULL) { | |
| #' | ||
| #' length(max_ivs(g)) | ||
| ivs <- function(graph, min = NULL, max = NULL) { | ||
| ensure_igraph(graph) | ||
|
|
||
| if (is.null(min)) { | ||
| min <- 0 | ||
| } | ||
|
|
||
| if (is.null(max)) { | ||
| max <- 0 | ||
| } | ||
|
|
||
| on.exit(.Call(Rx_igraph_finalizer)) | ||
| res <- .Call( | ||
| Rx_igraph_independent_vertex_sets, | ||
| graph, | ||
| as.numeric(min), | ||
| as.numeric(max) | ||
| independent_vertex_sets_impl( | ||
| graph = graph, | ||
| min_size = min %||% 0, | ||
| max_size = max %||% 0 | ||
| ) | ||
| res <- lapply(res, `+`, 1) | ||
|
|
||
| if (igraph_opt("return.vs.es")) { | ||
| res <- lapply(res, unsafe_create_vs, graph = graph, verts = V(graph)) | ||
| } | ||
|
|
||
| res | ||
| } | ||
|
|
||
| #' @rdname ivs | ||
|
|
||
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.
Which
igraph_*API is called by theRx_function?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.
Updated in 0d52819:
Rx_igraph_maximal_cliquescallsigraph_maximal_cliques_subset(). Themaximal_cliques_impldoesn't support the subset parameter.