WIP
This is the repository for D bindings of igraph library for the network analysis. It is based on igraph C API and ImportC functionality.
Currently only examples from Tutorial were tested. More examples are coming.
I recommend to build both C and D versions, to compare both results.
To build C example run in the terminal (with assumption, that the igraph library was installed in /usr path):
cc igraph_test.c -I/usr/include/igraph -L/usr/lib -ligraph -o igraph_test
At first you need to prepare igraph_lib.c
file, where you need to include required header files:
#include <path_to_the_lib/igraph.h>
You can preprocess file to eliminate macros manually (don't forget to add importc.h
):
clang -E igraph_lib.c -o igraph_lib.i -include /usr/include/dlang/ldc/importc.h
Compile with D compiler (which supports ImportC):
ldc2 igraph_test.d ./igraph_lib.i -L/usr/lib/libigraph.so
In later versions of D compilers (at least DMD 104.0, LDC 1.34), you can ask the compiler to do all job:
ldc2 igraph_test.d ./igraph_lib.c -L/use/lib/libigraph.so
- macOS (M1)
- Linux
- Windows
- Inline C macros
- Make code more iDiomatic
- Prepare examples from Tutorial
- Prepare Simple examples from C repository
Any form of contribution is welcome. Feel free to open an issue or create a pull request.
- igraph for original C API of the library
- Walter Bright for ImportC tool