robinCompare: robinCompare

View source: R/ROBIN_external_function.R

robinCompareR Documentation

robinCompare

Description

This function compares the robustness of two community detection algorithms.

Usage

robinCompare(
  graph,
  method1 = c("walktrap", "edgeBetweenness", "fastGreedy", "leadingEigen", "louvain",
    "spinglass", "labelProp", "infomap", "optimal", "leiden", "other"),
  args1 = list(),
  method2 = c("walktrap", "edgeBetweenness", "fastGreedy", "leadingEigen", "louvain",
    "spinglass", "labelProp", "infomap", "optimal", "leiden", "other"),
  args2 = list(),
  FUN1 = NULL,
  FUN2 = NULL,
  measure = c("vi", "nmi", "split.join", "adjusted.rand"),
  type = "independent",
  rewire.w.type = "Rewire",
  seed = NULL,
  verbose = TRUE,
  BPPARAM = NULL
)

Arguments

graph

The output of prepGraph.

method1

The first clustering method, one of "walktrap", "edgeBetweenness", "fastGreedy", "louvain", "spinglass", "leadingEigen", "labelProp", "infomap","leiden","optimal","other".

args1

A list of arguments to be passed to the method1 (see i.e. cluster_leiden for a list of possible method parameters).

method2

The second custering method one of "walktrap", "edgeBetweenness","fastGreedy", "louvain", "spinglass", "leadingEigen", "labelProp", "infomap","leiden","optimal","other".

args2

A list of arguments to be passed to the method2 (see i.e. cluster_leiden for a list of possible method parameters).

FUN1

personal designed function when method1 is "other". see methodCommunity.

FUN2

personal designed function when method2 is "other". see methodCommunity.

measure

The stability measure, one of "vi", "nmi", "split.join", "adjusted.rand" all normalized and used as distances. "nmi" refers to 1- nmi and "adjusted.ran" refers to 1-adjusted.rand.

type

The type of robin construction, dependent or independent.

rewire.w.type

for weighted graph. Option to rewire one of "Rewire", "Shuffle","Garlaschelli","Sum". "Garlaschelli" method only for count weights, "Sum" method only for continuous weights.

seed

set seed (default seed=NULL)

verbose

flag for verbose output (default as TRUE).

BPPARAM

optional BiocParallel parameter object. If NULL (default), uses parallel::mclapply on Unix/macOS or sequential lapply on Windows. If a BiocParallel object is supplied and the BiocParallel package is installed, it will be used instead.

Value

A robin object a list with: - "Mean1" and "Mean2" matrices with the means of the procedure for the first and the second method respectively. - "Communities1" and "Communities2" output communities with the first and second method respectively. - "Method1" and "Method2" the two community detection algorithm used - "graph" the input graph.

Examples

my_file <- system.file("example/football.gml", package="robin")
graph <- prepGraph(file=my_file, file.format="gml")
robinCompare(graph=graph, method1="louvain", args1 = list(resolution=0.8),
            method2="leiden")

robin documentation built on Nov. 18, 2026, 1:08 a.m.