concor_igraph_apply {concorR}R Documentation

Find CONCOR partition and add to a list of igraph objects

Description

Takes a list of igraph objects, runs concor until the desired number of splits, and adds the final split to each object as a vertex attribute.

Usage

concor_igraph_apply(igraph_list, nsplit = 1)

Arguments

igraph_list

The list of igraph objects for use in concor.

nsplit

Number of times to split each network.

Details

This function is a wrapper for a common task: Running concor on one or more igraph objects and adding the resulting partition to each object as a vertex attribute. If multiple igraph objects are included in the input list, they should be multiple relations for the same nodes.

If all of the input graphs are weighted, edge weights will be used by concor.

Value

Returns a list of igraph objects, each with a vertex attribute csplitn (where n is nsplit) that contains the block assignment obtained from concor.

See Also

concor, concor_make_igraph

Examples

a <- matrix(c(0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0), ncol = 4)
rownames(a) <- c("a", "b", "c", "d")
colnames(a) <- c("a", "b", "c", "d")
a.igraph <- igraph::graph_from_adjacency_matrix(a)
concor_igraph_apply(list(a.igraph))

b <- matrix(c(0, 0, 0, 4, 1, 0, 3, 0, 2, 1, 0, 1, 1, 0, 2, 0), ncol = 4)
rownames(b) <- c("a", "b", "c", "d")
colnames(b) <- c("a", "b", "c", "d")
b.igraph <- igraph::graph_from_adjacency_matrix(b, weighted = "weight")
concor_igraph_apply(list(b.igraph))

concor_igraph_apply(list(a.igraph, b.igraph))

[Package concorR version 0.2.1 Index]