IGraph/M


IGraph/M is a Mathematica package for use in complex networks and graph theory research. It started out as a well-integrated Mathematica interface to igraph, one of the most popular open source network analysis packages available. In addition to exposing igraph functionality to Mathematica, the current version of IGraph/M contains many other functions for working with graphs.

Highlights:

  • interface to most igraph functions
  • community detection methods
  • graph layouts
  • computation of centralities for weighted graphs and many other structural properties
  • graph motifs
  • isomorphism and subgraph finding for coloured graphs and multigraphs
  • graph colouring
  • planar graphs and combinatorial embeddings
  • conversion between geometric meshes and graphs
  • proximity graphs
  • a convenient graph property transformation framework for easy graph styling and property mapping
  • many other utility functions to make it easier to work with graphs in Mathematica

Load the package with

<<IGraphM`

The documentation can be opened using

IGDocumentation[]

and contains lots of examples.

All functions provided by the package have the prefix IG in their name to distinguish them from similar or equivalent functions built into Mathematica or provided by Combinatorica. See all available functions by evaluating

?IGraphM`*

The IGraph/M functions work directly on Mathematica's built-in Graph datatype.

g = IGBarabasiAlbertGame[50, 3]

Preferential attachment graph

Let's randomly rewire edges 1000 times while keeping the degree sequence:

g = IGRewire[g, 1000]

Rewired graph

Then we find the edges that we need to remove to make the graph acyclic:

feedback = IGFeedbackArcSet[g]
(* {2 -> 5, 3 -> 8, 5 -> 7, 10 -> 29, 17 -> 20} *)

AcyclicGraphQ@EdgeDelete[g, feedback]
(* True *)

Finally, we compute a minimum vertex colouring of the graph and visualize it.

 UndirectedGraph[g,
   GraphStyle -> "BasicBlack",
   VertexSize -> 0.7
 ] // IGVertexMap[ColorData[97], VertexStyle -> IGMinimumVertexColoring]

Minimum vertex colouring

The chromatic number, i.e. the minimum number of colours needed, is 4.

 IGChromaticNumber[g]
 (* 4 *)