Scheme, computer science, Basic Computer Science

There is a path between two vertices if there is a series of edges that you can use to travel between them. For example, between vertices 1 and 3 above, there is a path made up of the edges (1 2) and (2 3), written ((1 2)(2 3)). A path may not include repeated vertices.
Write two functions: in Scheme, a predicate path?, which takes a graph and two numbers indicating vertices, which returns true iff there is a path between them.:

(path? ''(5 ((1 2)(2 3)(3 4)(3 5)(4 5))) 1 5)
#t
(path? ''(5 ((1 2)(3 4)(3 5)(4 5))) 1 5)
#f

In Prolog, write a query path(+G, +V1, +V2) which succeeds iff there is a path in graph G between vertices V1 and V2.

path(graph(5, [[1,2],[2,3],[3,4],[3,5],[4,5]]), 1 5).
true.
path(graph(5, [[1,2],[3,4],[3,5],[4,5]]), 1 5).
false.
Posted Date: 2/24/2012 10:23:35 AM | Location : United States







Related Discussions:- Scheme, computer science, Assignment Help, Ask Question on Scheme, computer science, Get Answer, Expert's Help, Scheme, computer science Discussions

Write discussion on Scheme, computer science
Your posts are moderated
Related Questions
Simulated Annealing One way to answer the problem of local maxima and related problems like ridges and plateaux in hill climbing is to permit the agent to go downhill to some e

External interruptions are produced by peripheral devices, for example keyboards, printers, communication cards, etc. They are also produced by coprocessors. It is not achievable t

constant key use for in calculator

Question 1 Write a long note on the security features of Windows XP Question 2 Write a long note on computer peripherals, briefly describing some of the devices Question


Networks: There are different interpretations for the term °nets% The Oxford English Dictionary states that 'a network is an interconnected chain or system of immaterial thing

how to save a Vector theList to a .txt file and read that .txt file to a jsp page /??

Input Devices: i)  Keyboard is the most common form of input devices. It was originally designed in the last century. Since then, only minor improvements have taken place in k

Hi there, I''m just asking that do you do data mining assignment?