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.
Functionality highlights:
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]
Let's randomly rewire edges 1000 times while keeping the degree sequence:
g = IGRewire[g, 1000]
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]
The chromatic number, i.e. the minimum number of colours needed, is 4.
IGChromaticNumber[g]
(* 4 *)