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
Desk Top Publishing Program: Desktop publishing programs contain many of the features of word processing software, but .go even further in the ability to layout the format of

Working of a Computer Computer may be divided into the following units     Input Unit     Main Memory or Primary Storage Unit     Arithmetic-Logic Unit

Problem 1. Briefly explain on the characteristics of computers Explanation of characteristics of computers 2. Write a note on Cache Memory Note on Cache Memor


what is the size of a void integer and what is it''s range

The microprocessor is at times referred to as the ''brain'' of the personal computer, and is responsible for the processing of the instructions which creates computer software. It

mention the aims of education in present scenario

HTML is a Formatting language which is most commonly used for web documents.

Question 1 What is difference between cathode ray tube monitors and LCD monitors? List three popular types of operating systems and give brief introduction of each type Que

Question 1 Write about Potential Risks to Information Systems Factors to be addressed for making information systems more secure Question 2 Write about the foll