Github, but for graphs!
A temporal, versioned graph library in C++17 with Git-like branching & merging, time-travel snapshots, diffs, and graph algorithms.
Chronograph can be used for social-network evolution, financial audit trails, collaborative knowledge-graph editing, and more. Python support is provided via PyBind11.
-
Event Sourcing
Full history of node/edge additions, deletions, and updates with timestamps -
Snapshots & Time-Travel
View the graph at a certain point in time, or replay the graph changes between two points in time -
Diffing
Compute added/removed/updated nodes and edges between two points in time, or between two branches -
Repository & Commits
ChronoGraph provides aRespository
object at the top level. Changes to the graph are committed and stored asCommit
objects -
Branching & Merging
Graph repositories support branching, and fast-forward and three-way merges -
Graph Algorithms
Reachability, shortest paths, connected components, topological sorting, cycle detection, and more are offered in a dedicatedgraph/algorithms/
submodule
You need:
- CMake 3.14 or later
- A C++17-capable compiler (e.g. GCC 7+, Clang 5+)
- GoogleTest (or internet access: by default, GTest is fetched by CMake's FetchContent)
- For using ChronoGraph in python, see additional requirements in binding documentation
# 1) Clone the repo
git clone https://github.com/jun-simons/ChronoGraph.git
cd ChronoGraph
# 2) Create a build directory
mkdir build && cd build
# 3) Configure & build
cmake ..
make -j$(nproc) # or `cmake --build . -- -j4` on some platforms
# 4) (Optional) Run the unit tests
ctest --output-on-failure -V
# 5) (Optional) Run the example code
./examples/example_repo
#include <chronograph/graph/Graph.h>
#include <chronograph/graph/Snapshot.h>
using namespace chronograph;
Graph g;
g.addNode("n1", {{"name","Alice"}}, timestamp);
g.addNode("n2", {{"name","Bob"}}, timestamp);
g.addEdge("e1","n1","n2",{},timestamp);
Snapshot snap(g, someTimestamp);
auto nodes = snap.getNodes();
#include <chronograph/graph/algorithms/Paths.h>
using chronograph::graph::algorithms::isReachable;
bool canReach = isReachable(g, "A", "B");
#include <chronograph/repo/Repository.h>
auto repo = Repository::init("main");
repo.addNode("A", {...}, ts);
auto c1 = repo.commit("add A");
repo.branch("dev");
repo.checkout("dev");
repo.addNode("B", {...}, ts);
auto c2 = repo.commit("add B");
repo.checkout("main");
auto result = repo.merge("dev", MergePolicy::OURS);
For in-depth design and API details, see the docs/
folder.
MIT © Jun Simons
This project is in early development (www.junsimons.com)