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

Backup software, Backup software: A number of Backup software are avai...

Backup software: A number of Backup software are available that assist you in taking backup of your important data on the computer. Selecting between various back-up software

I/O Stream and Arrays, Write a program that: 1. Ask the user for names of t...

Write a program that: 1. Ask the user for names of the two iput files and a name of an output file. The two input files contain integers in any order. Eachimput file contains no mo

Description of Instruction execution, When software is installed onto a mod...

When software is installed onto a modern day personal computer (most commonly from a CD-ROM, though other media or downloading from the internet is also common), code comprising th

Cryptography, Consider the one-time pad encryption scheme to encrypt a 1-bi...

Consider the one-time pad encryption scheme to encrypt a 1-bit message m, and assume m is chosen with uniform distribution from message space M={0,1}. Let E1 be the event "message

Types of software interface, different types of software interfaces which f...

different types of software interfaces which falls in different categories

Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTION, Q: HOW DO YOU...

Q: HOW DO YOU CODE -- WITHOUT USING ARRAYS OR SPLIT FUNCTIONS -- TO SEPARATE COMMA SEPARATE NUMBER VALUES AND THEN SUM TO TOTAL? I.E., USING SUBSTRING AND INDEXOF. I''ve been try

C, board coloring

board coloring

What technical challenges must be overcome, QUESTION a) Clearly explain...

QUESTION a) Clearly explain three main issues arising in the design of components for use in Intranets. b) Explain the term "location-aware Computing". c) The Internet en

Explain the architecture of wap, Question 1 Discuss the benefits and goals...

Question 1 Discuss the benefits and goals of e-commerce Question 2 List and explain the features of portal Question 3 Elaborate the TCP/IP model Question 4 Explain the archi

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