If u have n edges, tree MUST have n+1 nodes by defintition
So when initialising graph, u must say len(edges)+1!! not len(edges)!