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
What is an encoder? Draw the logic circuit of Decimal to BCD encoder and explain its working.?

Question 1 What are the dos and don'ts of Internet Reporting? Question 2 Write a long note on the later years of journalism in USA Question 3 What is a search engi

ELEMENTS OF CPU: The CPU is a complex IC chip having millions of transistors. As mentioned earlier, a CPU has three major identifiable parts: Control Unit (CU), Arithmetic & l

There are many other techniques in which companies who manufacture microprocessors have attempted to get better the performance of their CPUs. Cache memory this is a small quantit

Uninformed Search Strategies: To be able to undertake a regular search, our entire agent ought to know is the starting state, the possible operators and how to check whether th

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

High level languages: High level languages (converted to machine code by compiler or equivalent) are much easier to program, as well as to understand. Several high level langu

board coloring

Program and Programming Language : A Program is defined as a collection of statements/ instructions that enable the computer to solve a problem. The process of writing a prog

find the regular expression of(a/?)(a/b)?