Crandore Hub

scalednap

Community Detection by Scaled Null-Adjusted Persistence

Finds the vertex partition of an undirected graph that maximises a persistence-based objective, using the Milano local-search algorithm. Three related quality measures are supported: the persistence probability of a community, its null-adjusted persistence (NAP), and the scaled null-adjusted persistence (Scaled-NAP), which interpolates between NAP and modularity. The methods are described in Avellone et al. (2023) <doi:10.1007/s10288-023-00559-z> and Avellone et al. (2025) <doi:10.1016/j.ins.2025.123032>.

README

<!-- README.md is generated from README.Rmd. Please edit that file -->

# scalednap

<!-- badges: start -->

<!-- badges: end -->

The goal of scalednap is to …

## Installation

You can install the stable version of **scalednap** from
[CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("scalednap")
```

If you want to try the latest development version with the newest
updates, you can install it from [CRAN](https://CRAN.R-project.org)
using:

``` r
# install.packages("pak")
pak::pak("aavellone/scalednap-r")
```

## Example

This is a basic example which shows you how to solve a common problem
using **scalednap**:

``` r
library(scalednap)

# --- EXAMPLE 1: Standard input (vectors and matrices) ---
edg <- c(1, 2, 1, 3, 1, 4, 2, 3, 3, 4, 4, 5, 5, 6, 5, 7, 6, 7)
edge_list <- matrix(edg, ncol = 2, byrow = TRUE)
vertex <- c(1, 2, 3, 4, 5, 6, 7)

cluster_milano(x = vertex, edge_list = edge_list)
#> $membership
#> [1] 1 1 1 1 2 2 2
#> 
#> $score
#> [1] 0.7662338
#> 
#> $seed
#> [1] "3563829245"

# --- EXAMPLE 2: igraph input ---
if (requireNamespace("igraph", quietly = TRUE)) {
  g <- igraph::make_ring(10)
  cluster_milano(g)
}
#> $membership
#>  [1] 1 1 2 2 3 3 4 4 5 5
#> 
#> $score
#> [1] 1.5
#> 
#> $seed
#> [1] "806094222"
```

Versions across snapshots

VersionRepositoryFileSize
1.0.0 rolling linux/jammy R-4.5 scalednap_1.0.0.tar.gz 68.6 KiB
1.0.0 rolling linux/noble R-4.5 scalednap_1.0.0.tar.gz 143.9 KiB
1.0.0 rolling source/ R- scalednap_1.0.0.tar.gz 68.6 KiB
1.0.0 latest linux/jammy R-4.5 scalednap_1.0.0.tar.gz 68.6 KiB
1.0.0 latest linux/noble R-4.5 scalednap_1.0.0.tar.gz 143.9 KiB
1.0.0 latest source/ R- scalednap_1.0.0.tar.gz 68.6 KiB
1.0.0 2026-04-23 source/ R- scalednap_1.0.0.tar.gz 0 B

Dependencies (latest)

Suggests