Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: netrics
Title: Many Ways to Measure and Classify Membership for Networks, Nodes, and Ties
Version: 0.2.0
Date: 2026-03-21
Version: 0.2.1
Date: 2026-04-04
Description: Many tools for calculating network, node, or tie
marks, measures, motifs and memberships of many different types of networks.
Marks identify structural positions, measures quantify network properties,
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# netrics 0.2.1

## Package

- Added network analysis tutorials from `{manynet}`

## Members

- Added more explanation for `node_in_partition()`

# netrics 0.2.0

## Package
Expand Down
65 changes: 37 additions & 28 deletions R/member_community.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,31 @@ node_in_community <- function(.data){
}
}

# #' @rdname member_community_hier
# #' @section Ensemble:
# #' Ensemble-based community detection runs community detection
# #' algorithms over multilayer or multiplex networks.
# #' @references
# #' ## On ensemble-based community detection
# #' Tagarelli, Andrea, Alessia Amelio, and Francesco Gullo. 2017.
# #' "Ensemble-based Community Detection in Multilayer Networks".
# #' _Data Mining and Knowledge Discovery_, 31: 1506-1543.
# #' \doi{10.1007/s10618-017-0528-8}
# #' @examples
# #' node_in_ensemble(ison_adolescents)
# #' @export
# node_in_ensemble <- function(.data, linkage_constraint = TRUE){
# if(missing(.data)) {expect_nodes(); .data <- .G()}
# clust <- igraph::cluster_walktrap(manynet::as_igraph(.data))
# out <- clust$membership
# make_node_member(out, .data)
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out node_in_ensemble block contains a redundant make_node_member(out, .data) call that discards its return value and is immediately repeated with assignment. This looks like leftover/debug code; consider removing the unused call (or the entire commented-out block) to avoid confusion about intended behavior.

Suggested change
# make_node_member(out, .data)

Copilot uses AI. Check for mistakes.
# out <- make_node_member(out, .data)
# attr(out, "hc") <- stats::as.hclust(clust,
# use.modularity = igraph::is_connected(.data))
# attr(out, "k") <- max(clust$membership)
# out
# }

# Non-hierarchical community clustering ####

#' Memberships in non-hierarchical communities
Expand All @@ -71,9 +96,6 @@ node_in_community <- function(.data){
#' These functions offer algorithms for partitioning
#' networks into sets of communities:
#'
#' - `node_in_community()` runs either optimal or, for larger networks,
#' finds the algorithm that maximises modularity and returns that membership
#' vector.
#' - `node_in_optimal()` is a problem-solving algorithm that seeks to maximise
#' modularity over all possible partitions.
#' - `node_in_partition()` is a greedy, iterative, deterministic
Expand Down Expand Up @@ -122,6 +144,16 @@ node_in_optimal <- function(.data){
}

#' @rdname member_community_non
#' @section Partition:
#' The general idea is to assign nodes to two groups, and then iteratively
#' swap pairs of nodes (one from each group) that give a positive sum of net tie costs,
#' where the net tie cost of a node is the difference between the sum
#' of the weights of ties to nodes in the other group (external costs) and
#' the sum of the weights of ties to nodes in the same group (internal costs).
#' This is a deterministic algorithm that will always return the same partition
#' for a given network, but it is not guaranteed to maximise modularity.
#' Note that this algorithm is only applicable to undirected, unipartite networks,
#' and will always return two communities of equal size (or as close to equal as possible).
#' @references
#' ## On partitioning community detection
#' Kernighan, Brian W., and Shen Lin. 1970.
Expand Down Expand Up @@ -182,7 +214,8 @@ node_in_partition <- function(.data){
#' @section Infomap:
#' Motivated by information theoretic principles, this algorithm tries to build
#' a grouping that provides the shortest description length for a random walk,
#' where the description length is measured by the expected number of bits per node required to encode the path.
#' where the description length is measured by the expected number of bits
#' per node required to encode the path.
#' @param times Integer indicating number of simulations/walks used.
#' By default, `times=50`.
#' @references
Expand Down Expand Up @@ -520,27 +553,3 @@ node_in_walktrap <- function(.data, times = 50){
out
}

# #' @rdname member_community_hier
# #' @section Ensemble:
# #' Ensemble-based community detection runs community detection
# #' algorithms over multilayer or multiplex networks.
# #' @references
# #' ## On ensemble-based community detection
# #' Tagarelli, Andrea, Alessia Amelio, and Francesco Gullo. 2017.
# #' "Ensemble-based Community Detection in Multilayer Networks".
# #' _Data Mining and Knowledge Discovery_, 31: 1506-1543.
# #' \doi{10.1007/s10618-017-0528-8}
# #' @examples
# #' node_in_ensemble(ison_adolescents)
# #' @export
# node_in_ensemble <- function(.data, linkage_constraint = TRUE){
# if(missing(.data)) {expect_nodes(); .data <- .G()}
# clust <- igraph::cluster_walktrap(manynet::as_igraph(.data))
# out <- clust$membership
# make_node_member(out, .data)
# out <- make_node_member(out, .data)
# attr(out, "hc") <- stats::as.hclust(clust,
# use.modularity = igraph::is_connected(.data))
# attr(out, "k") <- max(clust$membership)
# out
# }
7 changes: 3 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

0 errors | 0 warnings | 0 notes

- There are no references describing all methods in this package,
but the documentation files for each set of functions are complete and include examples.
- The use of cat() in one function has been avoided.
- All user-facing functions now have return values specified in their documentation.
- While last package submission was only 9 days ago:
- Updates to bring netrics into line with latest version of manynet (> v2.0.0)
- Fixes a reverse dependency issue in cross-package documentation referencing
Loading
Loading