First implementation of BP graph