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
I need someone to help me with my Unix/Linux homework.

Give a topology (network diagram) in which there is a link whose failure will change many routes. Give one in which there is a link whose failure will not change any routes

QUESTION a) What is Time Division Multiplexing (TDM), illustrate your answer with a diagram b) Describe four types of RTCP messages c) i) What is silence compression in I

Iterative Deepening Search- Artificial intelligence: So, breadth first search is guaranteed to find a solution (if one exists), but it grape whole memory. However, Depth first

Word Processing Software : The main use for word processing is found in secretarial offices and small publishing companies. However, if you are involved in generating your own cor

what is the meaning of data definition

Question 1 Define and explain flow chart with an example Question 2 Write an algorithm to print all even numbers in descending order and draw the flowchart Question 3 Explain

They are used to reduce or enlarge the content of the counters. DEC INC DEC INSTRUCTION Idea: To diminish the operator. Syntax: DEC destiny This action subtracts 1 from the destiny

Mini Computers and Micro Computers: The mini computers are intermediate in power, and may function as small mainframe computers. They are often dedicated to a particular purpo

what factors might be significant in your decision