Write a program that computes a ground state (as a vector of spins) and the ground state energy for an Ising spin model on a tree.This problem on general graphs is NP-complete, but on trees it is solvable in polynomial time using dynamic programming. The program can be written in Python.