concorigraphapply: Find CONCOR partition and add to a list of 'igraph' objects

Description Usage Arguments Details Value See Also Examples

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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))

concorR documentation built on Nov. 26, 2020, 1:08 a.m.