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 structuures, write a fuctions for MIDSQUARING hashing technique

write a fuctions for MIDSQUARING hashing technique

ToDoMenu, In this assignment, you should create a class called ToDoMenu whi...

In this assignment, you should create a class called ToDoMenu which has a main method that contains the code that implements a command-line menu for managing a collection of ToDoIt

Computer graphics, A scaling constant indicates an expansion of length

A scaling constant indicates an expansion of length

Visual Basic 2012, Can someone help me write a code for force = mass * acce...

Can someone help me write a code for force = mass * acceleration.

Microprocessor, how does microprocessor interpret with the burglar alarmn

how does microprocessor interpret with the burglar alarmn

Central processing unit, Central Processing Unit Microprocessor Th...

Central Processing Unit Microprocessor The microprocessor is an important component in the CPU. It is the unit which processes the instructions depending on its capability

Basic computer structure, Basic computer structure: A computer is an el...

Basic computer structure: A computer is an electronic device, which can accept and process data by carrying out a set of stored instructions in sequence. This sequence of math

Computer science, Explain Canonical cover and Extraneous Attributes with ex...

Explain Canonical cover and Extraneous Attributes with examples.

Process killed, 1. What actions need to be taken when a program terminates ...

1. What actions need to be taken when a program terminates or a process is killed? What if that process destruction is not the consequence of normal termination, but rather is the

Why learning of Assembly language is beneficial?, The first reason to work ...

The first reason to work with assembler is that it offers the opportunity of knowing more the operation of your PC, which permits the development of software in a more constant man

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