diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index da977ca338f..7ffeebbbc20 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -43,6 +43,10 @@ See the tidyverse guide on [how to create a great issue](https://code-review.tid * We use [testthat](https://cran.r-project.org/package=testthat) for unit tests. Please add test cases for the change you are proposing, or ask us for help. + +### Naming conventions + +* Use `max` for maximal and `largest` for maximum. ### Test files diff --git a/NAMESPACE b/NAMESPACE index 976df8fc2a4..f9b1d4851d9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -665,6 +665,7 @@ export(max_cliques) export(max_cohesion) export(max_degree) export(max_flow) +export(max_ivs) export(maxcohesion) export(maximal.cliques) export(maximal.cliques.count) diff --git a/R/cliques.R b/R/cliques.R index 6388c8fbd91..6798fe11682 100644 --- a/R/cliques.R +++ b/R/cliques.R @@ -4,14 +4,14 @@ #' @description #' `r lifecycle::badge("deprecated")` #' -#' `maximal.independent.vertex.sets()` was renamed to `maximal_ivs()` to create a more +#' `maximal.independent.vertex.sets()` was renamed to `max_ivs()` to create a more #' consistent API. -#' @inheritParams maximal_ivs +#' @inheritParams max_ivs #' @keywords internal #' @export maximal.independent.vertex.sets <- function(graph) { # nocov start - lifecycle::deprecate_soft("2.0.0", "maximal.independent.vertex.sets()", "maximal_ivs()") - maximal_ivs(graph = graph) + lifecycle::deprecate_soft("2.0.0", "maximal.independent.vertex.sets()", "max_ivs()") + max_ivs(graph = graph) } # nocov end #' Functions to find cliques, i.e. complete subgraphs in a graph @@ -382,7 +382,7 @@ weighted_clique_num <- weighted_clique_number_impl #' sets in the graph. An independent vertex set is largest if there is no #' independent vertex set with more vertices. #' -#' `maximal_ivs()` finds the maximal independent vertex +#' `max_ivs()` finds the maximal independent vertex #' sets in the graph. An independent vertex set is maximal if it cannot be #' extended to a larger independent vertex set. The largest independent vertex #' sets are maximal, but the opposite is not always true. @@ -401,7 +401,7 @@ weighted_clique_num <- weighted_clique_number_impl #' vertex sets to find. `NULL` means no limit. #' @return `ivs()`, #' `largest_ivs()` and -#' `maximal_ivs()` return a list containing numeric +#' `max_ivs()` return a list containing numeric #' vertex ids, each list element is an independent vertex set. #' #' `ivs_size()` returns an integer constant. @@ -428,7 +428,7 @@ weighted_clique_num <- weighted_clique_number_impl #' # Empty graph #' induced_subgraph(g, largest_ivs(g)[[1]]) #' -#' length(maximal_ivs(g)) +#' length(max_ivs(g)) ivs <- function(graph, min = NULL, max = NULL) { ensure_igraph(graph) @@ -472,7 +472,7 @@ largest_ivs <- function(graph) { #' @rdname ivs #' @export -maximal_ivs <- function(graph) { +max_ivs <- function(graph) { ensure_igraph(graph) on.exit(.Call(R_igraph_finalizer)) @@ -486,6 +486,21 @@ maximal_ivs <- function(graph) { res } +#' Maximal independent vertex sets in the graph +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `maximal_ivs()` was renamed to `max_ivs()` to create a more +#' consistent API. +#' @export +#' @inheritParams max_ivs +#' @keywords internal +maximal_ivs <- function(graph) { + lifecycle::deprecate_soft("2.0.4", "maximal_ivs()", "max_ivs()") + max_ivs(graph) +} + #' @rdname ivs #' @export ivs_size <- function(graph) { diff --git a/inst/lifecycle/deprecated.csv b/inst/lifecycle/deprecated.csv index bb265a7c93d..51307fc8bff 100644 --- a/inst/lifecycle/deprecated.csv +++ b/inst/lifecycle/deprecated.csv @@ -186,7 +186,7 @@ list.vertex.attributes,igraph::max_cohesion maximal.cliques,igraph::max_cliques maximal.cliques.count,igraph::count_max_cliques -maximal.independent.vertex.sets,igraph::maximal_ivs +maximal.independent.vertex.sets,igraph::max_ivs minimal.st.separators,igraph::min_st_separators maximum.bipartite.matching,igraph::max_bipartite_match maximum.cardinality.search,igraph::max_cardinality diff --git a/man/ivs.Rd b/man/ivs.Rd index ef9c3c443c5..caf2f80ad10 100644 --- a/man/ivs.Rd +++ b/man/ivs.Rd @@ -3,7 +3,7 @@ \name{ivs} \alias{ivs} \alias{largest_ivs} -\alias{maximal_ivs} +\alias{max_ivs} \alias{ivs_size} \title{Independent vertex sets} \usage{ @@ -11,7 +11,7 @@ ivs(graph, min = NULL, max = NULL) largest_ivs(graph) -maximal_ivs(graph) +max_ivs(graph) ivs_size(graph) } @@ -28,7 +28,7 @@ vertex sets to find. \code{NULL} means no limit.} \value{ \code{ivs()}, \code{largest_ivs()} and -\code{maximal_ivs()} return a list containing numeric +\code{max_ivs()} return a list containing numeric vertex ids, each list element is an independent vertex set. \code{ivs_size()} returns an integer constant. @@ -47,7 +47,7 @@ arguments. sets in the graph. An independent vertex set is largest if there is no independent vertex set with more vertices. -\code{maximal_ivs()} finds the maximal independent vertex +\code{max_ivs()} finds the maximal independent vertex sets in the graph. An independent vertex set is maximal if it cannot be extended to a larger independent vertex set. The largest independent vertex sets are maximal, but the opposite is not always true. @@ -71,7 +71,7 @@ largest_ivs(g) # Empty graph induced_subgraph(g, largest_ivs(g)[[1]]) -length(maximal_ivs(g)) +length(max_ivs(g)) } \references{ S. Tsukiyama, M. Ide, H. Ariyoshi and I. Shirawaka. A new diff --git a/man/maximal.independent.vertex.sets.Rd b/man/maximal.independent.vertex.sets.Rd index 9e53faec2d5..c1cfd4ccecc 100644 --- a/man/maximal.independent.vertex.sets.Rd +++ b/man/maximal.independent.vertex.sets.Rd @@ -13,7 +13,7 @@ loop edges and multiple edges are ignored.} \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} -\code{maximal.independent.vertex.sets()} was renamed to \code{maximal_ivs()} to create a more +\code{maximal.independent.vertex.sets()} was renamed to \code{max_ivs()} to create a more consistent API. } \keyword{internal} diff --git a/man/maximal_ivs.Rd b/man/maximal_ivs.Rd new file mode 100644 index 00000000000..d469785305b --- /dev/null +++ b/man/maximal_ivs.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cliques.R +\name{maximal_ivs} +\alias{maximal_ivs} +\title{Maximal independent vertex sets in the graph} +\usage{ +maximal_ivs(graph) +} +\arguments{ +\item{graph}{The input graph, directed graphs are considered as undirected, +loop edges and multiple edges are ignored.} +} +\description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{maximal_ivs()} was renamed to \code{max_ivs()} to create a more +consistent API. +} +\keyword{internal}