An Algorithm to Learn Polytree Networks with Hidden Nodes