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
what is the size of a void integer and what is it''s range

Programming Languages A number of programming languages are available for program writing. These languages can be classified as follows:     Machine language     Assem

Question 1 Explain in detail the different modes of Transportation Question 2 State the meaning of Distribution Strategies. Discuss the different Distribution Strategies

Write an Assembly program that reads an integer (-32,768 through 32,767) in decimal and prints its equivalent in binary. The output must show all 16 bits. And you must use a loop

which computer architecture use single bus structure??????? tells the name and little bit working


Description A semaphore is a confined variable whose value can be accessed and changed only by the operations P and V and initialization operation known as ''Semaphoiinitislize''.

The Internet is replete with great success stories and sad failures. While it is always nice to hear about the successes, more can probably be learned from the failures. In this ca


Two dimensional Arrays:  A two-dimensional array is like a table, with a defined number of rows, where each row has a defined number of columns. In some instances we need to  hav