Skip to content

Commit

Permalink
Add min_order argument
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Nov 17, 2023
1 parent 44bfc92 commit fd9f4d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* Added `graph_is_eulerian()` and `edge_rank_eulerian()` for eulerian path
calculations
* Added `to_random_spanning_tree()` morpher
* Added `min_order` argument to `to_components()` morpher

# tidygraph 1.2.3

Expand Down
4 changes: 3 additions & 1 deletion R/morphers.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ to_split <- function(graph, ..., split_by = NULL) {
#' @describeIn morphers Split a graph into its separate components. When
#' unmorphing all data in the subgraphs will get merged back.
#' @param type The type of component to split into. Either `'weak'` or `'strong'`
#' @param min_order The minimum order (number of vertices) of the component.
#' Components below this will not be created
#' @importFrom igraph decompose
#' @export
to_components <- function(graph, type = 'weak') {
to_components <- function(graph, type = 'weak', min_order = 1) {
graphs <- decompose(graph, mode = type)
graphs <- lapply(graphs, as_tbl_graph)
graphs
Expand Down

0 comments on commit fd9f4d0

Please sign in to comment.