Question: Implement a Python function Tree that takes as input two lists, representing the vertices and edges of a graph. The function should output True if

Implement a Python function Tree that takes as input two lists, representing the vertices and edges of a graph. The function should output True if the input graph represents a tree and False otherwise.

The vertices will be represented as a list of vertex names and the edges will be represented as a list of two-element lists of vertices.

For example, a call to Tree(["a","b","c"],[["a","b"]["b","c"]]) should return True

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!