IGraph/M: a Mathematica interface for igraph

igraph is one of the most popular network analysis packages available. It has official interfaces for C, Python and R, and several other unofficial ones. IGraph/M is an effort to create a polished, well-intergrated and easy to use Mathematica interface for igraph.

IGraph/M is a bit different from other igraph interfaces. Mathematica already has extensive graph theory and network analysis functionality, and IGraph/M does not aim to replace this. Instead it is meant to complement it and integrate with it, so functions from both systems can be used seamlessly together. Thus it works directly with Mathematica’s Graph datatype. Trivial functionality that is already present in Mathematica, such as adding or removing edges, converting to/from an adjacency matrix, etc., is not exposed. The focus is on functionality that is not present in Mathematica, and functionality that complements Mathematica’s builtins in a meaningful way.

IGraph/M comes pre-packaged and ready to use on Windows, OS X and Linux (64-bit Intel), as well as the Raspberry Pi computer. The code is open source and can be compiled on other platforms as well (such as 32-bit Windows).

A PDF version of the documentation notebook (12 MB) is available for preview purposes.


Download the .paclet file form the GitHub releases page, and install it using the PacletInstall Mathematica function. For example, if IGraphM-0.3.92.paclet was downloaded into the directory ~/Downloads, then evaluate


A more detailed guide for installing packages disitributed in the paclet format is available on StackExchange.

Usage and documentation

To get started, load the package with


Now the documentation can be opened using the command IGDocumentation[]. It contains many usage examples.

IGraph/M being a one-man effort so far, the builtin documentation is not complete. To learn about a particular function, please go through the following steps:

To get basic information on a function, first look at its usage message. For example:


IGCommunitiesEdgeBetweenness[graph] finds communities using the Girvan–Newman algorithm.

For a more detailed description, look up the function in the documentation notebook (IGDocumentation[]). Mathematica-specific details are usually described here.

For an even more detailed description of the functionality, or to learn about the implementation of various functions, check the official C/igraph documentation. It usually includes references to the papers describing the implemented algorithms.

All IGraph/M function names start with the prefix IG, and related functions use a consistent naming. For example, all community detection functions are named as IGCommunities...


All graph layout functions are named as IGLayout..., all random graph generators are called IG...Game, etc.

Feature highlights

As of IGraph/M 0.3, not all of the igraph functionality is exposed. Contributions are welcome, and feature requests are accepted (just open a new issue).

  • Interruption support: using Evaluate → Abort Evaluation in Mathematica works with most IGraph/M functions.
  • Centrality measures for weighted graphs.
  • Fast estimates of vertex betweenness, edge betweenness and closeness centrality; for large graphs.
  • Community detection algorithms.
  • Minimum feedback arc set for weighted and unweighted graphs.
  • Find all cliques (not just maximal ones); count cliques of different sizes without storing them; work with weighted cliques.
  • Count 3- and 4-motifs; find triangles.
  • Histogram for shortest path lengths (weighted and unweighted).
  • Rewire edges, keeping either the density or the degree sequence.
  • Alternative fast algorithms for isomorphism testing: Bliss, VF2, LAD.
  • Subgraph isomorphism (including induced subgraphs with LAD).
  • Isomorphism for edge or vertex coloured graphs; multigraph isomorphism implementation based on edge colouring.
  • Alternative algorithms for generating random graphs with given degree sequence; test for degree sequence graphicality.
  • Additional layout algorithms: most work with weighted graphs and can continue the layout optimization starting from a given set of vertex positions.
  • Biconnected components, articulation points, find all minimum vertex cuts.
  • Several other specialized functions not mentioned here …

The documentation contains many examples and can be accessed using the IGDocumentation[] command.

Feedback, bugs and troubleshooting

If you find a problem with the package, first check the Troubleshooting section of the README file. If the information there does not help resolve the problem, email me or open a new issue at the tracker. Be sure to include the output of IGraphM`Developer`GetInfo[] in your report.

For any other type of feedback, just send an email. Remember that the project is open for contributions!

Comments !