- It provides an easy-to-use graph data structure together with several
operations and algorithms over graphs,
in Graph.Pack.
It is a reasonably efficient imperative data structure for directed graphs
with vertices and edges labeled with integers.
Have a look at this module first in order to get an overview of what this library provides. See also demo.ml.

- Then OCamlgraph provides several other graph implementations for those
not satisfied with the one above. Some are persistent (imutable) and other
imperative (mutable). Some are
directed and other are not.
Some have labels for vertices, or labels for edges, or both.
Some have abstract types for vertices. etc.
See interface Sig for the graph signatures and modules Persistent and Imperative for the implementations.

These implementations are written as functors: you give the types of vertices labels, edge labels, etc. and you get the data structure as a result.

- Finally, OCamlgraph provides several classic operations and algorithms over graphs. They are also written as functors i.e. independently of the data structure for graphs. One consequence is that you can define your own data structure for graphs and yet re-use all the algorithms from this library -- you only need to provide a few operations such as iterating over all vertices, over the successors of a vertex, etc. See module Path for an example.

Papers describing OCamlgraph:

Code Examples:

- sudoku.ml : solving the Sudoku using the graph coloring module Coloring
- demo_planar.ml : displays a random planar graph and demonstrates depth-first and breadth-first traversals and Dijkstra's algorithm
- color.ml : displays a random planar graph and 4-color it

It is available as a source tarball:

You can access the download zone directly. Here are the recent CHANGES.

Alternatively, you can access the current development version on github:

https://github.com/backtracking/ocamlgraph

- Sylvain Conchon
- Jean-Christophe Filliâtre
- Julien Signoles

External contributors:

- Nicolas Ayache
- David Brumley
- Pierre-Loïc Garoche
- Ivan Jager
- Ted Kremenek
- Marc Lasson
- François Pottier
- Vincent Simonet
- Matthieu Sozeau
- Yuto Takei
- Markus Weißmann
- Boris Yakobowski