rFalque / libGraphCpp

Light C++11 graph library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Light C++11 graph library

We provide a simple and light graph library for visualizing and analyzing undirected graph structures. The library is inspired by Libigl, following its design principle and applied for graphs. The graphs are stored as .obj files (not all other formats support edges) which can be easily edited in Blender.

Graph visualization

Installation:

The only dependencies are Eigen and yaml-cpp which can be installed as follows:

sudo apt-get update
sudo apt-get install libeigen3-dev libyaml-cpp-dev

Then, simply type the following commands in the command line:

To build the library and the example

mkdir build
cd build
cmake ..
make

to build and run the tests:

mkdir build_tests
cd build_tests
cmake ../tests
make

Features:

  • graph instanciation from nodes list and edges list or adjacency matrix (Eigen::MatrixXd for nodes position and Eigen::MatrixXi for edges definition)
  • load / save graphs as .obj files
  • graph visualization (using polyscope)
  • adding / removing / merging nodes
  • adding / removing edges
  • edge collapsing
  • transformation into a tree, and basic trimming
  • fundamental cycle basis
  • graph simplification based on cycles
  • connectivity (linear time)
  • biconnectivity (linear time)
  • triconnectivity (quadratic time)
  • bridges detection (linear time)
  • shortest path on the graph (dijkstra)

Features to add:

  • graph augmentation

Design principles:

  • headers only library
  • simple structures for storing the graph (Eigen::Matrix) and adjacency lists (std::vector)
  • easy to modify

Graph visualization:

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). See this cheatsheet for a complete key map. Graph editing

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

About

Light C++11 graph library

License:MIT License


Languages

Language:C++ 91.6%Language:CMake 8.4%