https://www.geeksforgeeks.org/check-given-graph-tree/