Learn R Programming

⚠️There's a newer version (0.12.1) of this package.Take me there.

migraph

About the package

This package extends existing network analysis packages for analysing multimodal and multilevel networks. 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.

How does migraph help?

Works with your current network analysis workflow

The package is offered as a complement to existing R packages for network analysis and thus tries to work well with your existing analytic workflows and the classes invoked. All {migraph} measures and models work with data in base formats:

  • adjacency and incidence matrices
  • one-mode and two-mode data frame edgelists

as well as with objects from the following packages:

{migraph} can also import and export to Excel edgelists and UCINET files.

Extends your current network analysis workflow

{migraph} offers a range of measures and models with sensible defaults. Many wrap existing functions in common packages for use with one-mode networks, but extend these to treat and/or normalise for two-mode (and sometimes three-mode) networks correctly. Functions are given intuitive and succinct names that avoid conflicts with existing function names wherever possible.

Manipulation

  • Coercion between classes: as_igraph(), as_tidygraph(), as_network(), as_edgelist(), and as_matrix()
  • Logical tests of properties: e.g. is_twomode(), is_directed(), is_labelled(), is_weighted()
  • Transforming properties: to_undirected(), to_unnamed(), to_unweighted(), to_onemode(), and to_main_component()
  • From two-mode to one-mode: project_rows() and project_cols()

Measures

  • Centrality: node_degree(), node_closeness(), node_betweenness(), and node_eigenvector()
  • Centralization: graph_degree(), graph_closeness(), graph_betweenness(), and graph_eigenvector()
  • Cohesion: graph_density(), graph_reciprocity(), graph_transitivity(), graph_equivalency(), and graph_congruency()
  • Censuses: node_tie_census(), node_dyad_census(), node_triad_census(), node_mixed_census(), node_quad_census(), and graph_triad_census()
  • Other measures: e.g. node_constraint(), node_smallworld()

Models

  • Blockmodelling: blockmodel_concor(), cluster_structural_equivalence(), cluster_regular_equivalence()
  • Linear regression: netlm()

Visualization

  • autographr() for plotting graphs with sensible defaults based on their properties
  • New layouts: e.g. layout_tbl_graph_frgrid() for snapping Fruchterman-Reingold to a grid
  • Class-based plots: e.g. plot.blockmodel()

Please explore the list of functions to find out more.

Installation

Stable

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

install.packages('migraph')

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

library(migraph)

This will load any required packages and make the data contained within the package available. The version from CRAN also has all the vignettes built and included. You can check them out with:

vignettes(package = "migraph")

Development

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:

  • For Windows: install.packages("~/Downloads/migraph_winOS.zip", repos = NULL)
  • For Mac: install.packages("~/Downloads/migraph_macOS.tgz", repos = NULL)
  • For Unix: install.packages("~/Downloads/migraph_linuxOS.tar.gz", repos = NULL)

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

  • For latest stable version: remotes::install_github("snlab-ch/migraph")
  • For latest development version: remotes::install_github("snlab-ch/migraph@develop")

Relationship to other packages

It draws together, updates, and builds upon many functions currently available in other excellent R packages such as {bipartite}, {multinet}, and {tnet}, and implements many additional features currently only available outside the R ecosystem in packages such as UCINET.

Copy Link

Version

Install

install.packages('migraph')

Monthly Downloads

856

Version

0.8.13

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

James Hollway

Last Published

December 19th, 2021

Functions in migraph (0.8.13)

blockmodel_vis

ggplot2-based plotting of blockmodel results
autographr

Quickly graph networks with sensible defaults
coercion

Coercion between graph/network/edgelist/matrix object classes
brandes

One-mode centrality demonstration structure
cluster

Clustering algorithms
census

Census by nodes or clusters
add

Adding and copying attributes from one graph to another
centrality

Centrality for one- and two-mode networks
blockmodel

Blockmodelling
centralization

Centralization for one- and two-mode networks
ggatyear

Plotting network at particular timepoint (year)
diversity

Measures of network diversity
ison_community

Zachary's kareteka network
ison_eies

1DW 32(2) 440(1) EIES messages
defunct

Functions that have been renamed, superseded, or are no longer working
grab

Helpers to grab various attributes from nodes or edges in a graph
edge

Identifying edges by certain properties
generate

Create networks from particular probabilities
graph_balance

Structural balance
node_components

Identifying nodes' component membership
mpn_senate112

Two-mode 112th Congress Senate Voting
mpn_elite_usa_advice

Two-mode American power elite database
create

Create networks with particular structures
cohesion

Cohesion for one-, two-, and three- mode networks
mpn_elite_usa_money

Three-mode American power elite database
is

Tests of network properties
reexports

Objects exported from other packages
ggevolution

Plot the evolution of a network
ison_coleman

One-mode subset of adolescent society dataset
project

Projecting two-mode objects into one-mode objects
read

Reading from/writing to external formats
ison_projection

Two-mode projection examples
mpn_elite_mex

One-mode Mexican power elite database
regression

Linear regression for network data
ison_marvel

Multilevel two-mode affiliation, signed one-mode networks of Marvel comic book characters
mpn_bristol

Multimodal (3) Bristol protest events, 1990-2002
node_constraint

Constraint for one- and two-mode networks
node_smallworld

Watts-Strogatz small-world model for two-mode networks
to

Tools for reformatting networks, graphs, and matrices
ggtools

Visualising graphs and identifying nodes with maximum values of the specified measure.
mpn_ryanair

One-mode EU policy influence network, June 2004
gglineage

Plot lineage graph
graph_components

Number of components in the network
layouts

Layouts for one- and two-mode networks
graph_census

Censuses for the whole graph
tests

Conditional uniform graph and permutation tests
southern_women

Two-mode southern women dataset
m182

Multiplex igraph of friends, social, and task ties between 16 anonymous students
mpn_evs

Two-mode European Values Survey, 1990 and 2008