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

Factors and criteria for computer, what are the factors and criteria for co...

what are the factors and criteria for computer (from business point of view)?

Discuss the anatomy of xml document, Question 1 What is web browser? List ...

Question 1 What is web browser? List and explain the most common used web server Question 2 Discuss the anatomy of XML document Question 3 Discuss the various attr

What is Multilevel Feedback Queue Scheduling?, • Multilevel feedback queue...

• Multilevel feedback queue-scheduling algorithm enables a process to move among queues. It uses a number of ready queues and acquaintances a dissimilar priority with every queue.

Pseudocode, How Much Insurance? Many financial experts advise that property...

How Much Insurance? Many financial experts advise that property owners should insure their homes or buildings for at least 80 percent of the amount it would cost to replace the st

Methods of working with files, There are two methods to work with files, th...

There are two methods to work with files, the first one is through file control blocks or "FCB" and the second one is through communication channels, also identified as "handles".

Execution of a machine instruction, Execution of a machine instruction: ...

Execution of a machine instruction: Execution of a machine instruction on modern processors involves a complex sequence of operations with multiple cycles. One instruction cyc

Reasons for recommendation free and open source software, For multi-nationa...

For multi-national business IT system, free and open source software (FOSS) is recommended over a proprietary system. The reasons for this recommendation are: 1. Security I

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

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