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
1. The process abstraction is a popular way to organize concurrent programs, but it is not the only choice. An alternative to the process abstraction is to design a single-threaded

Two-tiered architecture: This approach basically introduced a database server to replace the file server. The emergence of relational database management systems and graphica

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

SYMBOLS CHART Every one of the parts on code line in assembler is known as token, for instance on the code line: MOV AX, Var We comprise three tokens, the MOV instruction, the AX o

Networking Operating Systems,  Networking OS provides file sharing, Networking OS provides communication scheme, NT Server Security added Multi user capability added RAI

Need help with javascript sb.append questions

I want the detailed theory about the options which occur when we right click on a folder.

Magnetic tapes and Magnetic Disk: Magnetic tapes are very commonly used for storing large quantum of data for which rapid access is not necessary; specially for archival data

Need of artificial intelligence: Artificial Intelligence may be seen as just the latest tool in the philosopher's toolbox for answering these all questions about the behavior o

Implementing the -Crochemore-Perrin algorithm The software must be functional, code must be clear and including comments and it must have a nice and decent user interface