Skip to content

Commit

Permalink
Remove old next_row function.
Browse files Browse the repository at this point in the history
  • Loading branch information
MHenderson committed Jun 4, 2024
1 parent 52fdfae commit 855a55a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 66 deletions.
39 changes: 0 additions & 39 deletions R/next-row.R
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
#' Find a compatible row for extending a latin rectangle
#'
#' Given an input latin rectangle this function will
#' generate a new row that can be added to the latin
#' rectangle.
#'
#' The method used is to create a bipartite graph
#' with vertex partitions for columns and symbols
#' missing from columns and then find a maximum
#' matching in that bipartite graph.
#'
#' @param R A latin square
#' @param l_order The order of the input latin square
#'
#' @return A bipartite graph.
next_row <- function(R, l_order) {
bg <- to_tidygraph(R, l_order)

m <- igraph::max_bipartite_match(bg)

# names of edges in the matching
matching_names <- match(m$matching, names(m$matching))

# add a matching indicator to the edges
bg <- bg |>
tidygraph::activate(edges) |>
dplyr::mutate(
matching = to == matching_names[from]
)

# just the matching itself, as a graph
mg <- bg |>
tidygraph::activate(edges) |>
dplyr::filter(matching)

EE <- igraph::ends(mg, igraph::E(mg))
return(as.numeric(gsub("s", "", EE[,2])))
}

#' Find a random new row for a latin rectangle
#'
#' @param R A latin rectangle
Expand Down
27 changes: 0 additions & 27 deletions man/next_row.Rd

This file was deleted.

0 comments on commit 855a55a

Please sign in to comment.