Quiz 2, Thursday, 10/1
(20 minutes. Open notes)
-
A triangle in a graph is a set of three vertices, say a,
b, and c, such that
a and b are connected by an edge,
b and c are connected by an edge, and
a and c are connected by an edge.
Write a method for the myListGraph class, called
isThereATriangle that determines if the graph contains
a triangle or not.
In other words, the first line of the method is:
public boolean isThereATriangle()
You may assume that the myListGraph class contains a boolean
method called isEdge that takes a pair of vertices and determines
whether they are connected by an edge or not.