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
The primary step is to start the Debug; this step only consists of typing debug [Enter] on the operative system on time. the "a" (assemble) command is used To assemble a program on

Question 1 Explain attributes, properties, and characteristics of system Question 2 What do understand from Organizational Aspects of System Life Cycles? Explain Question

DATA TRANSMISSION: When we talk on the telephone we generally transmit a message to someone else. The message is made up of words that we speak into the telephone instrument.

draw a block diagram to show organization of a computer system .explain or a units of computer system

Storage Mechanism of Magnetic disk: Storage Mechanism: Magnetic disk drives contain metal disks that are coated on both sides with an iron oxide recording material. Several

Problem A) The TCP/IP reference model is the network model used in the current Internet architecture. This model is derived from the OSI model and they are relatively same in n

In this program, you are going to write a program for playing the game of Hangman. In this game, the computer will pick a word and display a sequence of blanks to be filled in; one

how to use computer and how we can manage it

Question 1 Discuss the two basic operational characteristics of RR Only an active route is redistributed Route redistribution does not impact local route selection

Laser Printers: These printers can print a whole page at one command, offer highest quality and can combine text, graphics, etc. They are generally restricted to A4 paper and