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
As there are many variations in architecture between the different kinds of CPU, we shall begin my looking at an easy model of the structure. The basic model consists of five part


Problem 1 Write a recursive function to find sum of even numbers from 2 to 50 Writing function and explanation Problem 2 What is structure? Explain how structu

design railway maintenance system. draw er diagram.

write and run the following programs using 8086 assembly language that interchange the upper and lower four bits of AL register.

classify computer system according to capacity. how they are different from computer according to the classification of technology.provide the comparative study also.

What is an encoder? Draw the logic circuit of Decimal to BCD encoder and explain its working.?

Read World Population Data File. Store the values in multiple vectors. Sort them by most populated region and output the results ext file is here : please">http://www.csupomona.

A car battery is of 12 V. Eight dry cells of 1.5 V each connected in series can give 12 V. But such cells are not used in starting a car. Why?

Identify three factors to consider in determining the competitive value of information technology. Justify the selected factors. Of the factors selected, determine if each fact