Learn R Programming

persistence (version 0.2.0)

cluster_milano: cluster Milano

Description

Calculates the partition with maximum global null-adjuted persistence.

Usage

cluster_milano(
  vertex,
  edge_list,
  weights = NULL,
  membership = NULL,
  seed = NULL
)

Value

A list containing:

membeship

The optimal vertex partition.

value

The null-adjusted persistence of the partition.

seed

The used seed to generate random numbers.

Arguments

vertex

the vertices of the graph, whose label are integers and they must be consistent with the edge sets.

edge_list

the graph edge list in the form of an integer matrix with two columns.

weights

the graph edge weights.

membership

An integer vector representing the vertex start partition: x_i = k if i in C_k.

seed

As some steps of the algorithm are random, users may experiments with different seeds of random numbers.

Examples

Run this code
library(persistence)
library(igraph)

edg = c(1, 2, 1, 3, 1, 4, 2, 3, 3, 4, 4, 5, 5, 6, 5, 7, 5, 8, 5, 9, 6, 7, 6, 8, 7, 9, 8, 9)
print(length(edg) / 2.0)
vertex = unique(edg)
edg = t(matrix(as.integer(edg), nrow = 2 ))
rete <- graph_from_edgelist(edg, directed = FALSE)
plot(rete)
seed <- sample(1:as.integer(.Machine$integer.max),1, replace= FALSE)
r = cluster_milano(vertex, edg, seed=seed)


Run the code above in your browser using DataLab