graphw is a C++ library for graph drawing and network analysis. The library implements various algorithms to construct, analyze, and model complex networks.
Install SDL2 to draw graphs.
- Download the headers in
graphw/
. - Either put the header files in a central location (with a specified path) or directly in your project tree.
Documentation can be found in docs/
.
$ mkdir build
$ cd build
$ cmake ..
$ make
A simple example that constructs and models a graph in a circular layout.
#include <graphw/graphw.hpp>
#include <graphw/graphw_draw.hpp>
int main() {
graphw::CircularLayout g;
g.add_edge("a", "b");
g.add_edge("b", "c");
g.add_edge("c", "a");
graphw::draw(g);
}
Example of a balanced tree in a spiral layout.
#include <graphw/graphw.hpp>
#include <graphw/graphw_draw.hpp>
int main() {
graphw::SpiralLayout g;
g.set_node_radius(0);
g.add_balanced_tree(2, 10);
graphw::draw(g);
}
More examples can be found in examples/
.
Benchmarking does not require any external dependencies.
Compile with:
$ make benchmark
Testing requires Catch2.
Compile with:
$ make test