[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] IGraphR: Using igraph from Mathematica
From: |
Szabolcs Horvát |
Subject: |
[igraph] IGraphR: Using igraph from Mathematica |
Date: |
Mon, 26 Jan 2015 16:38:38 -0500 |
Hello igraph users,
I would like to bring your attention to a small Mathematica package I
wrote that makes it possible to use igraph from within Mathematica.
https://github.com/szhorvat/IGraphR
http://szhorvat.net/pelican/using-igraph-from-mathematica.html
igraph already has interfaces for C, R & Python, and this package adds
one more. It actually communicates with R/igraph through
Mathematica's RLink. Mathematica also has a built-in graph datatype
and many graph processing functions. This package will auto-translate
between Mathematica and igraph graphs. I find that igraph's and
Mathematica's functionality complement each other nicely.
Usage is simple: just wrap any R/igraph function with IGraph[...] and
use it as if it were a Mathematica function.
For example, let's make a random graph with the same degree sequence
as Zachary's karate club network:
g = address@hidden@address@hidden"NetworkGraph",
"ZacharyKarateClub"}];
igraph can do this too, but Mathematica uses a different and exact
algorithm. igraph's is much faster but only approximate.
Now let's find it's edge and vertex betweenness using igraph:
IGraph["edge.betweenness"][g]
IGraph["betweenness"][g]
We can also generate a graph using igraph and return it to Mathematica:
IGraph["barabasi.game"][20]
The package supports directed and undirected graphs, multigraphs, and
arbitrary vertex names.
I have posted about this package a year or so ago but at that time it
was much less complete and had some bugs. If you have the old
version, please upgrade: https://github.com/szhorvat/IGraphR
Szabolcs
- [igraph] IGraphR: Using igraph from Mathematica,
Szabolcs Horvát <=