create Tree class for shortest spanning tree