libDAI is a free and open source C++ library (licensed under GPL) that provides implementations of various (approximate) inference methods for discrete graphical models. libDAI supports arbitrary fac