Simple C++ Graph Library
We provide a simple and light graph library for visualizing and analyzing graph structures. The library builds upon Libigl, following its design principle and adapt it for graphs. The graphs are stored as .obj
files (not all other formats support edges) which can be easily edited in Blender.
The repository hosting the code is available here: https://github.com/rFalque/libGraphCpp
Installation:
Install libigl and Eigen which are dependencies. Depending on how Libigl has been installed, you might need to update the location of the library in the src/cmake/FindLIBIGL.cmake
file.
Then simply type the following commands in the command line:
To build the library and the example
mkdir build
cd build
cmake ../src
make
to build and run the tests:
mkdir build_tests
cd build_tests
cmake ../src/tests
make
Features:
- graph instanciation from Eigen matrices (‘Eigen::MatrixXd’ for nodes position and ‘Eigen::MatrixXi’ for edges definition)
- graph visualization (using libigl and few headers from directional)
- removing nodes
- connectivity (linear time)
- biconnectivity (linear time)
- triconnectivity (quadratic time)
- bridges detection (linear time)
- shortest path on the graph
Features to add:
- graph augmentation
- add nodes
Design principles:
- header only library
- simple structures for storing the graph (Eigen::Matrix) and adjacency lists (std::vector)
- easy to modify
Graph visualization:
Graph editing:
Open Blender and start creating a graph. A mesh can be easily transformed into a graph by deleting the faces only (change to edit mode
, select everything a
, open the delete menu del
, pick Only faces
).
Other alternatives:
- OGDF: (C++) self-contained class library for the automatic layout of diagrams. OGDF offers sophisticated algorithms and data structures to use within your own applications or scientific projects (including triconnectivity tests in linear time with SPQR decomposition)
- BOOST: (more?) efficient implementation
- Matlab graph class: sweet one