Data set

A weighted bipartite network describing a plant-flower visitor interaction web (25 plant species and 79 flower visitor species) in the vicinity of Bristol, U.K. To distinguish between the two node sets we number the pollinator species from 1-79 and the plants from 80-104. Data can be obtained using data(memmott1999) in package bipartite.



Input

A link list with columns from, to and weight. Because this is a bipartite network the from column can only contain nodes 1-79 and the to column nodes 84-104.



R Code

# Import data
library(infomapecology)
library(bipartite)
## Loading required package: sna
## Loading required package: statnet.common
## 
## Attaching package: 'statnet.common'
## The following objects are masked from 'package:rlang':
## 
##     base_env, empty_env
## The following objects are masked from 'package:base':
## 
##     attr, order
## Loading required package: network
## 
## 'network' 1.17.2 (2022-05-20), part of the Statnet Project
## * 'news(package="network")' for changes since last version
## * 'citation("network")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## Attaching package: 'network'
## The following objects are masked from 'package:igraph':
## 
##     %c%, %s%, add.edges, add.vertices, delete.edges, delete.vertices, get.edge.attribute, get.edges,
##     get.vertex.attribute, is.bipartite, is.directed, list.edge.attributes, list.vertex.attributes,
##     set.edge.attribute, set.vertex.attribute
## sna: Tools for Social Network Analysis
## Version 2.7 created on 2022-05-09.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##  For citation information, type citation("sna").
##  Type help(package="sna") to get started.
## 
## Attaching package: 'sna'
## The following objects are masked from 'package:igraph':
## 
##     betweenness, bonpow, closeness, components, degree, dyad.census, evcent, hierarchy, is.connected,
##     neighborhood, triad.census
##  This is bipartite 2.17.
##  For latest changes see versionlog in ?"bipartite-package". For citation see: citation("bipartite").
##  Have a nice time plotting and analysing two-mode networks.
## 
## Attaching package: 'bipartite'
## The following object is masked from 'package:infomapecology':
## 
##     nullmodel
## The following object is masked from 'package:vegan':
## 
##     nullmodel
## The following object is masked from 'package:igraph':
## 
##     strength
data(memmott1999)

network_object <- create_monolayer_network(memmott1999, bipartite = T, directed = F, group_names = c('A','P'))
## [1] "Input: a bipartite matrix"
infomap_object <- run_infomap_monolayer(network_object, infomap_executable='Infomap',
flow_model = 'undirected',
silent=T, trials=20, two_level=T, seed=123)
## [1] "Creating a link list..."
## running: ./Infomap infomap.txt . --tree --seed 123 -N 20 -f undirected --silent --two-level
## [1] "Removing auxilary files..."
# Plot the matrix (plotting function in beta)
plot_modular_matrix(infomap_object)


Infomap

Under the hood, the function run_infomap_monolayer runs:

./Infomap infomap.txt . --tree -i link-list --seed 123 -N 20 -f undirected -2

With this command, Infomap detects modules that contain both plants and pollinators. * -f undirected indicates flow on an undirected network. * -2 indicates a two-level solution, with no hierarchical modules.



Output

A tree file is produced by Infomap, but is parsed by run_infomap_monolayer from infomapecology (in R: ?run_infomap_monolayer).