[Graph] add method createSpanningTree()