Premal P.

asked • 10/06/20

Logic and if statement Question

Suppose that we are given a graph, in which V is the set of vertices and Edge(x, y) is a predicate which tells us that vertices x and y are connected by an edge. Assume that there are no self-looping edges which connect a vertex to itself, and also assume that the graph is undirected, so that if Edge(x, y) is true, then Edge(y, x) must also be true. The graph will be used to represents a map, in which the vertices are cities and edges are highways between cities.

Suppose that we say that a city is a ”big city” if it’s connected to three or more other cities by a highway. Write a definition for a new predicate, Isolated(x), which tells us that x is not a big city, and there is no read that we can take from x which can lead us (directly or indirectly) to a big city. If we pass through five different cities until we eventually reach a big city, then x is not isolated, but if there’s no way to ever reach a big city, then it is isolated.

Note: it is legal, but not necessary, to define yet another predicate to help define Isolated(x). Hint: it may be necessary to use a recursive definition.


1 Expert Answer

By:

Zak P. answered • 11/19/20

Tutor
New to Wyzant

Software Engineer & Experienced Computer Science Tutor

Zak P.

Just noticed a small error. In the last line of the Isolated() method, please change "return false;" to "return true;"-- my bad!
Report

11/19/20

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.