Python Markov Network Solver