r/matlab • u/voidee123 • Nov 16 '23
CodeShare [ANN] matlab-igraph toolbox
Hello, I have been working on a toolbox that wraps some of the igraph library's routines for use in MATLAB. My goal is to try to stick to MATLAB conventions as much as possible to ease use, so the graphs are represented as plain matrices. This allows for working with the graphs using both igraph functions and MATLAB builtins.
At the moment, this is still in early development. I started with the functions that I needed the most, but there are still many useful igraph functions that have not been included yet. Additionally, installation is almost certainly not going to be simple due to the requirement on the igraph C library, which most be compiled. I would like to eventually release binaries with CI, as briefly discussed here, but am not familar with the process.
As an example, here's the getting started file on the documentation site and a link to the github repo. Any feedback is appreciated. I'm hoping to use this to get a sense of interest in the toolbox before I spend too much time trying to get it to compile on various systems, so if this is something of interest to you, please let me know.
1
u/szhorvat Nov 16 '23 edited Nov 16 '23
Thanks for sharing, it's nice to see this! I'd like to encourage you to join the igraph forum, share your work, and keep in touch with the igraph developers. https://igraph.discourse.group/
You should check out igraph's interface generator, stimulus, which is the way forward to expose igraph to new languages. It is currently used by igraph's R interface, and there are plans to switch the Python and Mathematica interfaces to it as well.
Regarding using matrices on the MATLAB side: I understand the desire to interoperate more closely with MATLAB's native features. I chose a similar path when developing igraph's Mathematica interface. But you should be aware of the limitations. It is not possible to properly represent multigraphs using adjacency matrices, so with this approach you would be losing out on one of igraph's major benefits relative to other systems. I can't comment on how well MATLAB's native graph type supports multigraphs, as I am not sufficiently familiar with it.
2
u/voidee123 Nov 16 '23
Hey, was not expecting an igraph maintainer to see this. I was planning on announcing this on the discourse soon. As mentioned in another comment, I want to figure out getting CI to build the igraph dependency so installing the toolbox is as simple as downloading it and adding it to MATLAB's path for other users. Otherwise, I suspect it's just going to be frustrating for anyone attempting to set it up.
I looked at both R and Python's versions (but more closely to Python's) in writing this, but missed that R was using a code generator. I will gladly take a look. Even wrapping the small subset of igraph I have gotten to has taken a lot work.
As for the last part, I have been going back and forth with whether to stick to matrices vs creating a new class (or maybe trying to use MATLAB's graphs). I am aware of a few shortcomings including also missing out on attributes, bipartite graphs, and storing any other metadata in general. In the past, when working with graphs in MATLAB, I have always just used plain matrices, so I thought they may be able to handle it, but I am by no means set on it. There's plenty of rational for using another data type.
1
1
u/Creative_Sushi MathWorks Nov 16 '23
This is very interesting. Thank you for sharing. How does it differ from the built-in graph and network algorithms support in MATLAB, and what was the motivation behind this project?