Added DirectedGraph for flow algorithms, added graph cut algorithm for MAP, changed bivar_factor_product, some PEP changes