How to solve this simple problem?
You are given a tree of N vertices, and an integer K. How many ways are there to colour the tree with K colours such that no edge is adjacent to vertices of the same colour.
Since the answer may be large, output the answer modulo 1,000,000,007.
Please explain how did u arrive at the result?