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
Get step-by-step solutions from verified subject matter experts
