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

Kirchhoff’s law, A car battery is of 12 V. Eight dry cells of 1.5 V each ...

A car battery is of 12 V. Eight dry cells of 1.5 V each connected in series can give 12 V. But such cells are not used in starting a car. Why?

Define z-transform of sequence x[n], QUESTION (a) Define z-transform o...

QUESTION (a) Define z-transform of sequence x[n]. (b) A causal LTI system has impulse response h[n], for which the z-transform is                     H(z) = (1+z -1

Consistency or data in dbms, Consistency or data in DBMS Consistency - da...

Consistency or data in DBMS Consistency - data in DBMS(Database) is accurate in modeling real world, follows integrity constraints User may ensure transaction consistent by itsel

Power point, how to start ms power point

how to start ms power point

Operating system (o.s), Operating System (O.S) An operating syst...

Operating System (O.S) An operating system is the complete set of programs written to utilize the computer resources in an optimal manner. The operating system supervise

Necessary nurses records, Necessary Nurses Records The software shoul...

Necessary Nurses Records The software should generate all registers/reports in detail summary for various permutations and combinations of options. A powerful SQL (Structure

Flowcharts, flowchart that display yhe students average scores for 3 quizze...

flowchart that display yhe students average scores for 3 quizzes.Assume that there are 3 sections having 5 student each.Valid number is 1-100 for the quizzes.Enter an invalid numbe

Arinc 429 data bus specifications, ARINC 429 DATA Bus SPECIFICATIONS: A...

ARINC 429 DATA Bus SPECIFICATIONS: ARINC 429 sets specifications for the transfer of digital data between aircraft electronic system components and is a "One-way" communication

Briefly explain art driven character design, Question 1 What is role playi...

Question 1 What is role playing game? Explain the special design issues for sports games Question 2 What do you mean by collusion? Explain its types Question 3 Wri

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