Scheme, computer science, Basic Computer Science

Assignment Help:
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.

Related Discussions:- Scheme, computer science

Data communications, Data communication as a need developed in the 1960s wi...

Data communication as a need developed in the 1960s with the interconnection of peripheral devices to mainframe computers. Within the immediate vicinity of the mainframe computer t

Why is the atm selected as a transport network in 3g, Why is the ATM select...

Why is the ATM selected as a transport network in 3G? Answer: ATM provides efficient support for transmission of voice, data, and video ATM provides QoS guarantee and reliability

Backup storage, Backup Storage: Back up (backing) storage, also termed...

Backup Storage: Back up (backing) storage, also termed external storage, is used to hold programs and data which are read into internal storage when required. The most common

Why we need data mining? Give an example to illustrate your, Why we need da...

Why we need data mining? Give an example to illustrate your answer.

471, #que411stion..

#que411stion..

Programming Project 1, Programming Project You will implement 2 algorithms...

Programming Project You will implement 2 algorithms to solve the single source shortest paths problem, Bellman-Ford Algorithm and Dijkstra''s algorithm Allowed programming languag

What is an array? explain, Question 1 . What is an array? Explain Qu...

Question 1 . What is an array? Explain Question 2 . What do you mean by optional arguments? Describe Question 3 . Describe in brief about interfaces Question 4

Concept of instruction, Concept of instruction: The CPU is a semicondu...

Concept of instruction: The CPU is a semiconductor integrated  circuit chip consisting of a large number of transistors. In personal computers, the CPU is also referred by the

Electronic mail , Electronic mail is another PC to PC and PC to mainframe ...

Electronic mail is another PC to PC and PC to mainframe data exchange. If you subscribe to an electronic mail service, it will enable your PC to gain access to a 'mailbox' on a ma

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd