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
Understanding human intelligence in social AI can be taken as just the current tool in the philosopher's toolbox for answering of questions for the behaviour of human intellig

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

Question 1 List two I/O virtualization methods. Based on different features compare these two methods Question 2 Discuss three areas considered by organizations to secure the

Creating a new file For the formation of files the 21H interruption 16H function is used. DX must identify a control structure whose necessities are that as a minimum the logic uni

Question 1 Draw a neat diagram of the organization of computer and explain about each unit Question 2 Explain batch processing system and multi-processing in brief Questi

WHAT DO MEAN BY ALGORITHM,HOW CAN ALGORITHM HELP TO WRITE BETTER COMPUTER PROGRAM ,WRITE AN ALGORITHM IN COMPUTER INTEREST

Information Units In order for the PC to process information, it is essential that this information be in unique cells called registers. The registers are sets of 8 or 16 flip-flop



Data Base Software: Another major type of application comes under the heading database software; which allows for the collection of, searching for and manipulation of informat