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
Multiprogramming Multiprogramming means capability of several programs to simultaneously occupy a portion of the computer’s memory and compete for central processor time. Th

The project designs a school computer lab with the necessary hardware and software components along with the IP address for different components. The computer lab consists of one I

Software Licensing: Until early 1970's, sharing of software was the accepted norm. Hardware came bundled with software products which could be freely redistributed and the acc

ryby db fgrh herbgh buyh hehg gvo hb bbithbs bgshbshdgbh bubfvhb bs v h hjjg jdk jnmnv j

Disk output : You will already have decided whether to use a hard disk or floppies for storing data. An important point of disk management is to ensure a secure method of kee

Coaxial Cables: Another metallic transmission medium which offers a large bandwidth, is the coaxial cable. Such cables consist of an outer protective shell made of copper tube

Algorithm : Once a problem has been defined precisely, a procedure or process must be designed to produce the required output from the given input. Since a computer is a machine t

The 7489 TTL Ram Device: The 7489 TTL Ram package has 64 memory cells, each cell is capable of holding a single bit of data.  The cells are organised into locations, and each l

Specifying Search Problems In our agent terms, a problem to be solved is a particular task where the agent starts with the environment in a given state and acts upon the enviro

Does Process Manager in Operating System know the dependency order that Process A depends on Process B?