Lifecycle: maturing CRAN/METACRAN GitHub release (latest by date) GitHub Release Date Codecov test coverage CII Best Practices DOI

About the package

The most commonly used R packages available for network analysis, such as {igraph} or {sna}, are mainly oriented around directed or undirected one-mode networks. But researchers are increasingly interested in analysing multimodal (one-, two-, or three-mode), multilevel (connected multimodal networks), or multilayer (multiplex or signed) networks. Existing procedures typically involve ‘projecting’ them into one-mode networks so that they can be used with those tools, but thereby potentially losing important structural information, or require one or more other specific packages. Translating between packages various syntaxes and expectations can introduce significant transaction costs though, driving confusion, inefficiencies, and errors.

{migraph} builds upon {manynet} to offer smart solutions to these problems. It includes functions for marking and measuring networks and their nodes and ties, identifying motifs and memberships in them, and modelling these networks or simulating processes such as diffusion upon them. Based on {manynet}, every function works for any compatible network format - from base R matrices or edgelists as data frames, {igraph}, {network}, or {tidygraph} objects. This means it is compatible with your existing workflow, is extensible by other packages, and uses the most efficient algorithm available for each task.

The package is intended as a software companion to the book:

David Knoke, Mario Diani, James Hollway, and Dimitris Christopoulos (2021) Multimodal Political Networks. Cambridge University Press: Cambridge.

Most datasets used in the book are included in this package, and the package implements most methods discussed in the book. Since many of theses datasets and routines are discussed and analysed more there, if you like the package please check out the book, and vice versa.

How does migraph help?

{migraph} includes five special groups of functions, each with their own pretty print() and plot() methods: marks, measures, memberships, motifs, and models.

{migraph} uses a common syntax to help new and experienced network analysts find the right function and use it correctly. All network_*() functions return a value for the network/graph or for each mode in the network. All node_*() functions return values for each node or vertex in the network. And all tie_*() functions return values for each tie or edge in the network. Functions are given intuitive and succinct names that avoid conflicts with existing function names wherever possible. All results are normalised by default, facilitating comparison.


{migraph} also offers a large and growing smorgasbord of measures that can be used at the node, tie, and network level. Each recognises whether the network is directed or undirected, weighted or unweighted, one-mode or two-mode. All return normalized values wherever possible, though this can be overrided. Here are some examples:

Please explore the list of functions to find out more.

Motifs and Memberships

The package also include functions for returning various censuses at the network or node level, e.g.:

These can be analysed alone, or used as a profile for establishing equivalence. {migraph} offers both HCA and CONCOR algorithms, as well as elbow, silhouette, and strict methods for k-cluster selection.

{migraph} also includes functions for establishing membership on other bases, such as typical community detection algorithms, as well as component and core-periphery partitioning algorithms.


All measures can be tested against conditional uniform graph (CUG) or quadratic assignment procedure (QAP) distributions using:

Hypotheses can also be tested within multivariate models via multiple (linear or logistic) regression QAP:

{migraph} is the only package that offers these testing frameworks for two-mode networks as well as one-mode networks.



The easiest way to install the latest stable version of {migraph} is via CRAN. Simply open the R console and enter:1


You can then begin to use {migraph} by loading the package:


This will load any required packages and make the data contained within the package available.


For the latest development version, for slightly earlier access to new features or for testing, you may wish to download and install the binaries from Github or install from source locally.

The latest binary releases for all major OSes – Windows, Mac, and Linux – can be found here. Download the appropriate binary for your operating system, and install using an adapted version of the following commands:

To install from source the latest main version of {migraph} from Github, please install the {remotes} or {devtools} package from CRAN and then:


Together with {manynet}, this package makes available interactive {learnr} tutorials. The easiest way to access the tutorials is via run_tute(). If no tutorial name is provided, the function will return a list of tutorials currently available in either package:

#> # A tibble: 9 × 3
#>   package name      title        
#>   <chr>   <chr>     <chr>        
#> 1 manynet tutorial0 Intro to R   
#> 2 manynet tutorial1 Data         
#> 3 manynet tutorial2 Visualisation
#> 4 migraph tutorial3 Centrality   
#> 5 migraph tutorial4 Community    
#> 6 migraph tutorial5 Position     
#> 7 migraph tutorial6 Topology     
#> 8 manynet tutorial7 Diffusion    
#> 9 migraph tutorial8 Regression
# run_tute("tutorial5")

For more details on the {learnr} package, see here.

Relationship to other packages

{migraph} draws together, updates, and builds upon many functions currently available in other excellent R packages such as {bipartite}, {multinet}, {tnet}, and {xUCINET}.

Funding details

Most work on this package has been funded by the Swiss National Science Foundation (SNSF) Grant Number 188976: “Power and Networks and the Rate of Change in Institutional Complexes” (PANARCHIC).

  1. Macs with Macports installed may also install from the command line using Macports.