Running the Leiden algorithm with R on multiplex graphs

S. Thomas Kelly

2023-11-13

Clustering with the Leiden Algorithm on Multiplex Graphs

The Leiden R package supports calling built-in methods for Multiplex graphs. This vignette assumes you already have the ‘leiden’ package installed. See the other vignettes for details.

Set up

First we import the functions required in the package.

library("leiden")

We also require a example multiplex graph. Here we import a dataset from the ‘mplex’ package (bear in mind this is a remote package not available on CRAN).

remotes::install_github("Achab94/mplex")
multiplex_graph <- mplex::aarhus_mplex
multiplex_graph 
#> $lunch
#> IGRAPH 2059d07 DN-- 61 193 -- 
#> + attr: name (v/c)
#> + edges from 2059d07 (vertex names):
#>  [1] U102->U139 U102->U33  U22 ->U26  U22 ->U41  U22 ->U42  U22 ->U49  U26 ->U41  U26 ->U42  U26 ->U49  U29 ->U32 
#> [11] U29 ->U17  U29 ->U14  U32 ->U17  U32 ->U130 U32 ->U14  U32 ->U73  U41 ->U42  U42 ->U49  U42 ->U47  U59 ->U91 
#> [21] U59 ->U126 U59 ->U110 U59 ->U53  U59 ->U65  U59 ->U67  U59 ->U72  U97 ->U71  U97 ->U126 U97 ->U37  U97 ->U4  
#> [31] U97 ->U69  U97 ->U6   U124->U109 U124->U126 U124->U47  U124->U99  U17 ->U14  U17 ->U23  U17 ->U73  U71 ->U4  
#> [41] U71 ->U67  U71 ->U63  U86 ->U130 U91 ->U126 U91 ->U110 U91 ->U53  U91 ->U65  U91 ->U67  U91 ->U72  U109->U126
#> [51] U109->U134 U109->U18  U109->U3   U109->U47  U109->U54  U109->U62  U109->U76  U109->U79  U109->U90  U109->U99 
#> [61] U126->U54  U126->U90  U126->U37  U126->U110 U126->U113 U126->U138 U126->U72  U126->U69  U126->U6   U130->U134
#> [71] U130->U79  U130->U4   U130->U110 U134->U54  U134->U62  U134->U76  U134->U79  U134->U90  U134->U99  U134->U13 
#> + ... omitted several edges
#> 
#> $facebook
#> IGRAPH f219f59 DN-- 61 127 -- 
#> + attr: name (v/c)
#> + edges from f219f59 (vertex names):
#>  [1] U29 ->U32  U29 ->U91  U32 ->U71  U32 ->U91  U32 ->U130 U32 ->U4   U32 ->U110 U32 ->U67  U42 ->U49  U42 ->U79 
#> [11] U42 ->U142 U59 ->U91  U59 ->U110 U59 ->U113 U59 ->U67  U124->U91  U124->U109 U124->U130 U124->U134 U124->U18 
#> [21] U124->U3   U124->U47  U124->U54  U124->U76  U124->U79  U124->U69  U124->U6   U71 ->U79  U71 ->U4   U71 ->U110
#> [31] U71 ->U67  U91 ->U79  U91 ->U10  U91 ->U142 U91 ->U4   U91 ->U110 U91 ->U113 U91 ->U65  U91 ->U67  U91 ->U69 
#> [41] U109->U18  U109->U47  U109->U54  U109->U76  U109->U79  U130->U134 U130->U18  U130->U3   U130->U47  U130->U76 
#> [51] U130->U79  U130->U142 U130->U4   U130->U67  U18 ->U3   U18 ->U47  U18 ->U54  U18 ->U76  U18 ->U79  U3  ->U47 
#> [61] U3  ->U54  U3  ->U76  U3  ->U79  U47 ->U54  U47 ->U76  U47 ->U79  U47 ->U142 U47 ->U4   U54 ->U76  U54 ->U79 
#> [71] U54 ->U10  U54 ->U142 U54 ->U4   U76 ->U79  U76 ->U4   U76 ->U112 U79 ->U142 U79 ->U110 U79 ->U65  U10 ->U142
#> + ... omitted several edges
#> 
#> $coauthor
#> IGRAPH 8b7e975 D--- 61 27 -- 
#> + edges from 8b7e975:
#>  [1] 10->11 12->13 18->46 23->46 23->49 23->52 26->27 26->28 26->30 26->33 26->36 28->33 30->36 38->54 39->55  4-> 6
#> [17] 46->48 46->49 49->52  6->14  8->37 56->56 57->57 58->58 59->59 60->60 61->61
#> 
#> $leisure
#> IGRAPH 500ba7c DN-- 61 88 -- 
#> + attr: name (v/c)
#> + edges from 500ba7c (vertex names):
#>  [1] U22 ->U42  U29 ->U32  U29 ->U126 U42 ->U49  U42 ->U79  U42 ->U142 U59 ->U91  U59 ->U110 U59 ->U65  U59 ->U72 
#> [11] U124->U91  U124->U126 U124->U18  U124->U99  U17 ->U91  U17 ->U14  U17 ->U23  U17 ->U73  U91 ->U126 U91 ->U54 
#> [21] U91 ->U90  U91 ->U110 U91 ->U113 U91 ->U138 U91 ->U53  U91 ->U65  U91 ->U72  U91 ->U69  U109->U126 U109->U54 
#> [31] U109->U76  U109->U90  U126->U54  U126->U90  U126->U110 U126->U69  U18 ->U62  U18 ->U76  U18 ->U99  U3  ->U54 
#> [41] U3  ->U90  U47 ->U76  U54 ->U76  U54 ->U79  U54 ->U90  U54 ->U10  U62 ->U76  U76 ->U79  U76 ->U90  U79 ->U90 
#> [51] U79 ->U99  U79 ->U73  U79 ->U65  U90 ->U6   U10 ->U13  U10 ->U142 U10 ->U37  U10 ->U73  U142->U37  U142->U68 
#> [61] U106->U41  U106->U118 U14 ->U19  U14 ->U23  U14 ->U73  U19 ->U23  U19 ->U73  U23 ->U73  U4  ->U67  U110->U113
#> [71] U110->U138 U110->U65  U110->U67  U113->U138 U113->U65  U138->U72  U107->U32  U107->U17  U107->U91  U65 ->U72 
#> + ... omitted several edges
#> 
#> $work
#> IGRAPH 3351fca DN-- 61 194 -- 
#> + attr: name (v/c)
#> + edges from 3351fca (vertex names):
#>  [1] U22 ->U26  U22 ->U41  U22 ->U42  U22 ->U49  U26 ->U32  U26 ->U42  U26 ->U49  U26 ->U97  U26 ->U71  U26 ->U130
#> [11] U26 ->U79  U26 ->U110 U26 ->U140 U29 ->U32  U29 ->U17  U32 ->U97  U32 ->U17  U32 ->U86  U32 ->U130 U32 ->U14 
#> [21] U32 ->U73  U32 ->U110 U42 ->U79  U59 ->U91  U59 ->U110 U59 ->U67  U97 ->U71  U97 ->U4   U97 ->U67  U124->U130
#> [31] U124->U4   U139->U26  U139->U29  U139->U97  U139->U71  U139->U10  U139->U14  U139->U19  U139->U107 U139->U67 
#> [41] U139->U123 U139->U1   U17 ->U14  U17 ->U23  U17 ->U73  U71 ->U14  U71 ->U19  U71 ->U4   U71 ->U110 U71 ->U67 
#> [51] U71 ->U63  U71 ->U6   U71 ->U140 U91 ->U110 U91 ->U113 U91 ->U138 U91 ->U53  U91 ->U65  U91 ->U67  U91 ->U72 
#> [61] U109->U130 U109->U54  U109->U62  U126->U110 U126->U67  U126->U69  U130->U134 U130->U18  U130->U47  U130->U54 
#> [71] U130->U62  U130->U76  U130->U79  U130->U99  U130->U10  U130->U4   U134->U99  U134->U4   U18 ->U62  U3  ->U90 
#> + ... omitted several edges

Usage

Multiplex graph objects

Now we have a multiplex graph structure. This multiplex graph is a list of different igraph object, in the case representing different relationships between the sample people.

names(multiplex_graph)
#> [1] "lunch"    "facebook" "coauthor" "leisure"  "work"

Here we import a plotting function to display these 5 groups.

library("graphsim")
library("RColorBrewer")
par(mfrow = c(2, 3))
plot_directed(multiplex_graph$lunch, main = "lunch", col.arrow = brewer.pal(5, "Pastel1")[1], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$work, main = "work", col.arrow = brewer.pal(5, "Pastel1")[2], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$facebook, main = "facebook", col.arrow = brewer.pal(5, "Pastel1")[3], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$leisure, main = "leisure", col.arrow = brewer.pal(5, "Pastel1")[4], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$coauthor, main = "coauthor", col.arrow = brewer.pal(5, "Pastel1")[5], layout = layout.kamada.kawai)

This data can also be represented by an adjacency matrix derived from a graph object.

library("igraph")
multiplex_matrix <- lapply(multiplex_graph, igraph::as_adjacency_matrix)
multiplex_matrix 
#> $lunch
#> 61 x 61 sparse Matrix of class "dgCMatrix"
#>   [[ suppressing 61 column names 'U102', 'U139', 'U33' ... ]]
#>                                                                                                                       
#> U102 . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U139 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U33  . . . . . . 1 . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . . . 1
#> U106 . . . . . 1 . . . 1 1 . . 1 1 1 . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U107 . . . . . . . . . . . 1 1 . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U118 . . . . . . . . . 1 1 . . 1 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U123 . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . 1 . . . . . . . . . 1 . . . . . . 1 . . . . . 1
#> U1   . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 1 1 . . 1 . . . . . . . . . . . .
#> U21  . . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . . . . . . . . . . . . . . . 1 . . . . . . . 1 . . . . 1 .
#> U22  . . . . . . . . . . 1 . . 1 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U26  . . . . . . . . . . . . . 1 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U29  . . . . . . . . . . . . 1 . . . . . . 1 . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . .
#> U32  . . . . . . . . . . . . . . . . . . . 1 . . . . . 1 . . . . . . . . . . . . . 1 . . . . 1 . . . . . . . . . . . .
#> U41  . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U42  . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U49  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U59  . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . . . . . . . . . . . . . . . . . . . 1 . . 1 1 1 1 . . . . .
#> U97  . . . . . . . . . . . . . . . . . . . . 1 . . . 1 . . . . . . . . . . . . . . . . . 1 1 . . . . . . . . . . . 1 .
#> U124 . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . 1 . . . . . 1 . . . . . . . . . . . . . . . . . . . . .
#> U17  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . 1 . . . . . . . . . . . .
#> U71  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . . . 1
#> U86  . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U91  . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . 1 . . 1 1 1 1 . . . . .
#> U109 . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . . . . . . .
#> U126 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . 1 . . . . . . . 1 . . 1 1 1 . . . 1 . . . 1 .
#> U130 . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . . . . . . . 1 . 1 . . . . . . . . . . .
#> U134 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 1 1 . 1 . . . . . 1 . . . . . . . . . 1 . . .
#> U18  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 1 1 1 1 1 . . . . . . . . . . . . . . . . . . . . .
#> U3   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 1 . . . . . . . . . . . . . . . . . . . . . .
#> U47  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . . . . . . . . . . . . . . . . . . . .
#> U54  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 . . . . . . . . . . . . . . . . . . . . . .
#> U62  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 . . . . . . . . . . . . . . . . . . . . . .
#> U76  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 . . . . . . . . . . . . . . . . . . . . .
#> U79  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . . . . . . 1
#> U90  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U99  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U10  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . .
#> U13  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1 . . . . . . . . . . . . .
#> U142 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . .
#> U14  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . 1 . . . . . . . . . . . .
#> U19  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 . . . . . . . . . . . .
#> U23  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . .
#> U37  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1 .
#> U4   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 1 1 . 1
#> U73  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U110 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . 1 . . . . .
#> U113 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 1 . . . . .
#> U138 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . .
#> U53  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . . . .
#> U65  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . .
#> U67  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1
#> U72  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 .
#> U112 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . .
#> U48  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . .
#> U68  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U69  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U63  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U6   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U92  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U140 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U141 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>             
#> U102 . . . .
#> U139 . . . .
#> U33  . . . .
#> U106 . . . .
#> U107 . . . .
#> U118 . . . .
#> U123 . . . .
#> U1   . . . .
#> U21  1 . . .
#> U22  . . . .
#> U26  . . . .
#> U29  . . . .
#> U32  . . . .
#> U41  . . . .
#> U42  . . . .
#> U49  . . . .
#> U59  . . . .
#> U97  1 . . .
#> U124 . . . .
#> U17  . . . .
#> U71  . . . .
#> U86  . . . .
#> U91  . . . .
#> U109 . . . .
#> U126 1 . . .
#> U130 . . . .
#> U134 . 1 . .
#> U18  . . . .
#> U3   . . . .
#> U47  . . . .
#> U54  . . . .
#> U62  . . . .
#> U76  . . . .
#> U79  . . . .
#> U90  1 . . .
#> U99  . . . .
#> U10  . . . .
#> U13  . . . .
#> U142 . . . .
#> U14  . . . .
#> U19  . . . .
#> U23  . . . .
#> U37  1 . . .
#> U4   . 1 . 1
#> U73  . . . .
#> U110 . . . .
#> U113 . . . .
#> U138 . . . .
#> U53  . . . .
#> U65  . . . .
#> U67  . . . .
#> U72  . . . .
#> U112 . . . .
#> U48  . 1 . 1
#> U68  . 1 . 1
#> U69  1 . . .
#> U63  . . . .
#> U6   . . . .
#> U92  . . . 1
#> U140 . . . .
#> U141 . . . .
#> 
#> $facebook
#> 61 x 61 sparse Matrix of class "dgCMatrix"
#>   [[ suppressing 61 column names 'U102', 'U139', 'U33' ... ]]
#>                                                                                                                       
#> U102 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U139 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U33  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U106 . . . . 1 . 1 1 1 . . 1 1 . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U107 . . . . . . . . . . . 1 1 . . . . . 1 . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U118 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U123 . . . . . . . . . . . . 1 . 1 1 . . . . 1 . 1 . . 1 . . . 1 . . . . . . . . 1 . . . . 1 . . . . . . 1 . . . . . .
#> U1   . . . . . . . . . . . 1 1 . . . . . . . 1 . . . . . . . . . . . . 1 . . 1 . . . . . . . . . . . . . . . . . . . .
#> U21  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1 .
#> U22  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U26  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U29  . . . . . . . . . . . . 1 . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U32  . . . . . . . . . . . . . . . . . . . . 1 . 1 . . 1 . . . . . . . . . . . . . . . . . 1 . 1 . . . . 1 . . . . . .
#> U41  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U42  . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . 1 . . . . 1 . . . . . . . . . . . . . . . . . .
#> U49  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U59  . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . 1 . . . . . .
#> U97  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U124 . . . . . . . . . . . . . . . . . . . . . . 1 1 . 1 1 1 1 1 1 . 1 1 . . . . . . . . . . . . . . . . . . . . . 1 .
#> U17  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U71  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . 1 . 1 . . . . 1 . . . . . .
#> U86  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U91  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 . 1 . . . . 1 . 1 1 . . 1 1 . . . . 1 .
#> U109 . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 1 . 1 1 . . . . . . . . . . . . . . . . . . . . . . .
#> U126 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U130 . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 . . 1 1 . . . . 1 . . . . 1 . . . . . . 1 . . . . . .
#> U134 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U18  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 . 1 1 . . . . . . . . . . . . . . . . . . . . . . .
#> U3   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . 1 1 . . . . . . . . . . . . . . . . . . . . . . .
#> U47  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 1 . . . . 1 . . . . 1 . . . . . . . . . . . . .
#> U54  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . 1 . 1 . . . . 1 . . . . . . . . . . . . .
#> U62  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U76  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . 1 . . . . . . . . 1 . . . .
#> U79  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . 1 . . . . . . .
#> U90  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U99  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U10  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1 . . . . . . . . . . . . .
#> U13  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U142 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . . . 1 . . . . . .
#> U14  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U19  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U23  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U37  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U4   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1 . . . . . .
#> U73  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U110 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . 1 . . . . . .
#> U113 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . 1 .
#> U138 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U53  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U65  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . .
#> U67  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 .
#> U72  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U112 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U48  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U68  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U69  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U63  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U6   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U92  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U140 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U141 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>             
#> U102 . . . .
#> U139 . . . .
#> U33  . . . .
#> U106 . . . .
#> U107 . . . .
#> U118 . . . .
#> U123 . . . .
#> U1   . . . .
#> U21  1 . . .
#> U22  . . . .
#> U26  . . . .
#> U29  . . . .
#> U32  . . . .
#> U41  . . . .
#> U42  . . . .
#> U49  . . . .
#> U59  . . . .
#> U97  . . . .
#> U124 1 . . .
#> U17  . . . .
#> U71  . . . .
#> U86  . . . .
#> U91  . . . .
#> U109 . . . .
#> U126 . . . .
#> U130 . . . .
#> U134 . . . .
#> U18  . . . .
#> U3   . . . .
#> U47  . . . .
#> U54  . . . .
#> U62  . . . .
#> U76  . . . .
#> U79  . . . .
#> U90  . . . .
#> U99  . . . .
#> U10  . . . .
#> U13  . . . .
#> U142 . . . .
#> U14  . . . .
#> U19  . . . .
#> U23  . . . .
#> U37  . . . .
#> U4   . . . .
#> U73  . . . .
#> U110 . . . .
#> U113 . . . .
#> U138 . . . .
#> U53  . . . .
#> U65  . . . .
#> U67  1 . . .
#> U72  . . . .
#> U112 . . . .
#> U48  . . . .
#> U68  . . . .
#> U69  1 . . .
#> U63  . . . .
#> U6   . . . .
#> U92  . 1 . .
#> U140 . . 1 .
#> U141 . . . 1
#> 
#> $coauthor
#> 61 x 61 sparse Matrix of class "dgCMatrix"
#>                                                                                                                        
#>  [1,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>  [2,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>  [3,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>  [4,] . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>  [5,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>  [6,] . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>  [7,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>  [8,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . .
#>  [9,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [10,] . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [11,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [12,] . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [13,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [14,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [15,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [16,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [17,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [18,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . .
#> [19,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [20,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [21,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [22,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [23,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 . . 1 . . . . .
#> [24,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [25,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [26,] . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . 1 . . 1 . . 1 . . . . . . . . . . . . . . . . . . . . .
#> [27,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [28,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . .
#> [29,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [30,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . .
#> [31,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [32,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [33,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [34,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [35,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [36,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [37,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [38,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . .
#> [39,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . .
#> [40,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [41,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [42,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [43,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [44,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [45,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [46,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . . . . .
#> [47,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [48,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [49,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . .
#> [50,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [51,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [52,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [53,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [54,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [55,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [56,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 .
#> [57,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
#> [58,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [59,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [60,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> [61,] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>              
#>  [1,] . . . .
#>  [2,] . . . .
#>  [3,] . . . .
#>  [4,] . . . .
#>  [5,] . . . .
#>  [6,] . . . .
#>  [7,] . . . .
#>  [8,] . . . .
#>  [9,] . . . .
#> [10,] . . . .
#> [11,] . . . .
#> [12,] . . . .
#> [13,] . . . .
#> [14,] . . . .
#> [15,] . . . .
#> [16,] . . . .
#> [17,] . . . .
#> [18,] . . . .
#> [19,] . . . .
#> [20,] . . . .
#> [21,] . . . .
#> [22,] . . . .
#> [23,] . . . .
#> [24,] . . . .
#> [25,] . . . .
#> [26,] . . . .
#> [27,] . . . .
#> [28,] . . . .
#> [29,] . . . .
#> [30,] . . . .
#> [31,] . . . .
#> [32,] . . . .
#> [33,] . . . .
#> [34,] . . . .
#> [35,] . . . .
#> [36,] . . . .
#> [37,] . . . .
#> [38,] . . . .
#> [39,] . . . .
#> [40,] . . . .
#> [41,] . . . .
#> [42,] . . . .
#> [43,] . . . .
#> [44,] . . . .
#> [45,] . . . .
#> [46,] . . . .
#> [47,] . . . .
#> [48,] . . . .
#> [49,] . . . .
#> [50,] . . . .
#> [51,] . . . .
#> [52,] . . . .
#> [53,] . . . .
#> [54,] . . . .
#> [55,] . . . .
#> [56,] . . . .
#> [57,] . . . .
#> [58,] 1 . . .
#> [59,] . 1 . .
#> [60,] . . 1 .
#> [61,] . . . 1
#> 
#> $leisure
#> 61 x 61 sparse Matrix of class "dgCMatrix"
#>   [[ suppressing 61 column names 'U102', 'U139', 'U33' ... ]]
#>                                                                                                                       
#> U102 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U139 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U33  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U106 . . . . . 1 . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U107 . . . . . . . . . . . . 1 . . . . . . 1 . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U118 . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U123 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U1   . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 . 1 . . 1 . . . . . . . . . . . .
#> U21  . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U22  . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U26  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U29  . . . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U32  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U41  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U42  . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . 1 . . . . 1 . . . . . . . . . . . . . . . . . .
#> U49  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U59  . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . 1 . . . 1 . 1 . . . . .
#> U97  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U124 . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . 1 . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . .
#> U17  . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . 1 . 1 . . 1 . . . . . . . . . . . .
#> U71  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U86  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U91  . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . 1 . . . 1 . . . . . . . . . . 1 1 1 1 1 . 1 . . . 1 .
#> U109 . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . 1 . 1 . 1 . . . . . . . . . . . . . . . . . . . . . .
#> U126 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . 1 . . . . . . . . . . 1 . . . . . . . . . 1 .
#> U130 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U134 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U18  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . 1 . . . . . . . . . . . . . . . . . . . . .
#> U3   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . 1 . . . . . . . . . . . . . . . . . . . . . .
#> U47  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . .
#> U54  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 . 1 . . . . . . . . . . . . . . . . . . . .
#> U62  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . .
#> U76  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . .
#> U79  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . . . . . 1 . . . . 1 . . . . . . .
#> U90  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U99  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U10  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . 1 . 1 . . . . . . . . . . . .
#> U13  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U142 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . 1 . .
#> U14  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . 1 . . . . . . . . . . . .
#> U19  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 . . . . . . . . . . . .
#> U23  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . .
#> U37  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U4   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . .
#> U73  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U110 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . 1 1 . . . . . .
#> U113 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . . . . . .
#> U138 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . .
#> U53  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U65  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . .
#> U67  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U72  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U112 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U48  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U68  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U69  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U63  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U6   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U92  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U140 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U141 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>             
#> U102 . . . .
#> U139 . . . .
#> U33  . . . .
#> U106 . . . .
#> U107 . . . .
#> U118 . . . .
#> U123 . . . .
#> U1   . . . .
#> U21  . . . .
#> U22  . . . .
#> U26  . . . .
#> U29  . . . .
#> U32  . . . .
#> U41  . . . .
#> U42  . . . .
#> U49  . . . .
#> U59  . . . .
#> U97  . . . .
#> U124 . . . .
#> U17  . . . .
#> U71  . . . .
#> U86  . . . .
#> U91  . . . .
#> U109 . . . .
#> U126 . . . .
#> U130 . . . .
#> U134 . . . .
#> U18  . . . .
#> U3   . . . .
#> U47  . . . .
#> U54  . . . .
#> U62  . . . .
#> U76  . . . .
#> U79  . . . .
#> U90  1 . . .
#> U99  . . . .
#> U10  . . . .
#> U13  . . . .
#> U142 . . . .
#> U14  . . . .
#> U19  . . . .
#> U23  . . . .
#> U37  . . . .
#> U4   . . . .
#> U73  . . . .
#> U110 . . . .
#> U113 . . . .
#> U138 . . . .
#> U53  . . . .
#> U65  . . . .
#> U67  . . . .
#> U72  . . . .
#> U112 . . . .
#> U48  . . . .
#> U68  . . . 1
#> U69  . . . .
#> U63  . . . .
#> U6   . . . .
#> U92  . . . .
#> U140 . . . .
#> U141 . . . .
#> 
#> $work
#> 61 x 61 sparse Matrix of class "dgCMatrix"
#>   [[ suppressing 61 column names 'U102', 'U139', 'U33' ... ]]
#>                                                                                                                       
#> U102 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U139 . . . . 1 . 1 1 . . 1 1 . . . . . 1 . . 1 . . . . . . . . . . . . . . . 1 . . 1 1 . . . . . . . . . 1 . . . . . .
#> U33  . . . . . 1 1 . 1 . 1 . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . . . 1 . . . . . 1
#> U106 . . . . . 1 1 . . . 1 . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U107 . . . . . . . . . . . 1 1 . . . . . . 1 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U118 . . . . . . 1 . . . 1 . . 1 . . . 1 . . 1 . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . 1 . . . . . .
#> U123 . . . . . . . . . 1 1 . . . 1 1 . 1 1 1 1 . . . . 1 . 1 1 1 1 1 1 1 1 1 . . 1 . . . . 1 . 1 . . . . 1 . . . . . 1
#> U1   . . . . . . . . . . 1 . 1 . . . . . 1 . 1 . . . . 1 . . . . . . . 1 . . 1 . . 1 1 1 . . 1 . . . . . . . . . . . .
#> U21  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . .
#> U22  . . . . . . . . . . 1 . . 1 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U26  . . . . . . . . . . . . 1 . 1 1 . 1 . . 1 . . . . 1 . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . .
#> U29  . . . . . . . . . . . . 1 . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U32  . . . . . . . . . . . . . . . . . 1 . 1 . 1 . . . 1 . . . . . . . . . . . . . 1 . . . . 1 1 . . . . . . . . . . .
#> U41  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U42  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . .
#> U49  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U59  . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1 . . . . . .
#> U97  . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . 1 . . . . . .
#> U124 . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . .
#> U17  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 . . 1 . . . . . . . . . . . .
#> U71  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . 1 . 1 . . . . 1 . . . . . 1
#> U86  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U91  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 . . . . .
#> U109 . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . .
#> U126 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . 1 . . . . 1 .
#> U130 . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . 1 1 1 1 1 . 1 1 . . . . . . 1 . . . . . . . . . . . . .
#> U134 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . 1 . . . . . . . . . . . . .
#> U18  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . .
#> U3   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . .
#> U47  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . 1 . . . . . . . . . . . . . . . . . . . . .
#> U54  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . 1 . . 1 . . 1 . . . . . . . . . . . . .
#> U62  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . .
#> U76  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . .
#> U79  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . 1 . 1 . . . . . . . . . . .
#> U90  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . .
#> U99  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . .
#> U10  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 . . 1 . . . . . . . . . . . .
#> U13  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . 1 . . .
#> U142 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . 1 . .
#> U14  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . 1 . . . . . . . . . . . .
#> U19  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 . . . . . . . . . . . .
#> U23  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . .
#> U37  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . .
#> U4   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . 1 1 1 . 1
#> U73  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U110 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 . 1 1 . . . . .
#> U113 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . 1 . . . . . .
#> U138 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . .
#> U53  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U65  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . .
#> U67  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . 1 1
#> U72  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U112 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . .
#> U48  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 .
#> U68  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U69  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U63  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U6   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U92  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U140 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#> U141 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
#>             
#> U102 . . . .
#> U139 . . . .
#> U33  . . . .
#> U106 . . . .
#> U107 . . . .
#> U118 . . . .
#> U123 . . . .
#> U1   . . . .
#> U21  . . . .
#> U22  . . . .
#> U26  . . 1 .
#> U29  . . . .
#> U32  . . . .
#> U41  . . . .
#> U42  . . . .
#> U49  . . . .
#> U59  . . . .
#> U97  . . . .
#> U124 . . . .
#> U17  . . . .
#> U71  1 . 1 .
#> U86  . . . .
#> U91  . . . .
#> U109 . . . .
#> U126 . . . .
#> U130 . . . .
#> U134 . . . .
#> U18  . . . .
#> U3   . . . .
#> U47  . . . .
#> U54  . . . .
#> U62  . . . .
#> U76  . . . .
#> U79  . . . .
#> U90  . . . .
#> U99  . . . .
#> U10  . . . .
#> U13  . 1 . .
#> U142 . . . .
#> U14  . . . .
#> U19  . . . .
#> U23  . . . .
#> U37  . . . .
#> U4   . 1 . 1
#> U73  . . . .
#> U110 . . . .
#> U113 . . . .
#> U138 . . . .
#> U53  . . . .
#> U65  . . . .
#> U67  1 . . .
#> U72  . . . .
#> U112 . . . .
#> U48  . . . .
#> U68  . . . 1
#> U69  . . . .
#> U63  . . . .
#> U6   . . . .
#> U92  . . . .
#> U140 . . . .
#> U141 . . . .

Running the Leiden algorithm in R

Then the Leiden algorithm can be run on the adjacency matrix using a partition type for Multiplex graphs. Here the types are computed automatically.

partition <- leiden(multiplex_graph,
                       partition_type = "CPMVertexPartition",
                       resolution_parameter = 0.025,
                       seed = 9001)
#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range
table(partition)
#> partition
#>  1  2  3  4  5 
#> 34 12  8  6  1

Here we can see that the partitions are defined across all graphs in the list.

library("graphsim")
library("RColorBrewer")
node.cols <- brewer.pal(min(c(9, partition)),"Pastel1")[partition]
par(mfrow = c(2, 3))
plot_directed(multiplex_graph$lunch, main = "lunch", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[1], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$work, main = "work", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[2], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$facebook, main = "facebook", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[3], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$leisure, main = "leisure", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[4], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$coauthor, main = "coauthor", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[5], layout = layout.kamada.kawai)

This can also be run on a list of adjacency matrices giving the same results.

partition <- leiden(multiplex_matrix,
                       partition_type = "CPMVertexPartition",
                       resolution_parameter = 0.025,
                       seed = 9001)
#> Warning in deparse(substitute(arg)): NAs introduced by coercion to integer range
#> Warning in paste(sig, collapse = "#"): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range

#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range

#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range
#> Warning in deparse(substitute(arg)): NAs introduced by coercion to integer range
#> Warning in paste(sig, collapse = "#"): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range

#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range

#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range
#> Warning in deparse(substitute(arg)): NAs introduced by coercion to integer range
#> Warning in paste(sig, collapse = "#"): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range
#> Warning in deparse(substitute(arg)): NAs introduced by coercion to integer range
#> Warning in paste(sig, collapse = "#"): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range

#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range

#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range
#> Warning in deparse(substitute(arg)): NAs introduced by coercion to integer range
#> Warning in paste(sig, collapse = "#"): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in deparse(x[[1L]]): NAs introduced by coercion to integer range
#> Warning in deparse(expr, width.cutoff, ...): NAs introduced by coercion to integer range
#> Warning in paste(deparse(expr, width.cutoff, ...), collapse = collapse): NAs introduced by coercion to integer range
#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range

#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range

#> Warning in paste0("igraph::", x): NAs introduced by coercion to integer range
#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range
table(partition)
#> partition
#>  1  2  3  4  5 
#> 34 12  8  6  1

Fine-tuning with resolution

The resolution parameter applies on multiplex graphs to fine-tuning how many clusters are detected.

partition <- leiden(multiplex_graph, partition_type = "CPMVertexPartition", resolution_parameter = 0.1, seed = 42)
#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range
table(partition)
#> partition
#>  1  2  3  4  5  6  7  8  9 10 
#> 14 11 11  8  7  4  3  1  1  1
library("graphsim")
library("RColorBrewer")
node.cols <- brewer.pal(min(c(9, partition)),"Pastel1")[partition]
par(mfrow = c(2, 3))
plot_directed(multiplex_graph$lunch, main = "lunch", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[1], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$work, main = "work", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[2], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$facebook, main = "facebook", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[3], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$leisure, main = "leisure", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[4], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$coauthor, main = "coauthor", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[5], layout = layout.kamada.kawai)

Fine-tuning with maximum community size

The resolutionmax_comm_size` parameter applies on multiplex graphs to fine-tuning the size of clusters detected.

partition <- leiden(multiplex_graph, partition_type = "CPMVertexPartition", max_comm_size = 8, resolution_parameter = 0.1, seed = 42)
#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range
table(partition)
#> partition
#>  1  2  3  4  5  6  7  8  9 10 11 12 
#>  8  8  8  7  7  6  5  5  4  1  1  1
library("graphsim")
library("RColorBrewer")
node.cols <- brewer.pal(min(c(9, partition)),"Pastel1")[partition]
par(mfrow = c(2, 3))
plot_directed(multiplex_graph$lunch, main = "lunch", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[1], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$work, main = "work", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[2], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$facebook, main = "facebook", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[3], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$leisure, main = "leisure", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[4], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$coauthor, main = "coauthor", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[5], layout = layout.kamada.kawai)

Multiplex cost functions

Any defined cost function is supported for multiplex graphs. For example, the Modularity Vertex Partition is also supported.

partition <- leiden(multiplex_graph, partition_type = "ModularityVertexPartition", resolution_parameter = 0.02, seed = 42)
#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range

#> Warning in make_py_graph.igraph(r_graph, weights = weights): NAs introduced by coercion to integer range
table(partition)
#> partition
#>  1  2  3  4  5  6 
#> 15 13 13 11  8  1

Here we can see partitions in the plotted results are different to as those computed above.

library("graphsim")
library("RColorBrewer")
node.cols <- brewer.pal(max(c(8, partition)),"Pastel1")[partition]
par(mfrow = c(2, 3))
plot_directed(multiplex_graph$lunch, main = "lunch", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[1], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$work, main = "work", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[2], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$facebook, main = "facebook", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[3], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$leisure, main = "leisure", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[4], layout = layout.kamada.kawai)
plot_directed(multiplex_graph$coauthor, main = "coauthor", col.label  = node.cols, col.arrow = brewer.pal(5, "Pastel1")[5], layout = layout.kamada.kawai)