Consider the adjacency list (list of neighbors) data structure representation of a directed, weighted graph. For example

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Consider the adjacency list (list of neighbors) data structure representation of a directed, weighted graph. For example

Post by answerhappygod »

Consider the adjacency list (list of neighbors) data structurerepresentation of a directed, weighted graph. For example, (setqgraph '( (a (b 3) (c 1)) (b (a 3) (d 2)) (c (a 1) (d 2) (e 2)) (d(b 1) (c 2) (e 1) (g 2)) (e (c 2) (d 1) (f 3)) (f (e 3) (g 1)) (g(d 2) (f 1)) ) )The first element of each sub-list is the sourcenode and the tail of the sub-list are pairs of neighbor/weight. Forexample, the sub-list (a (b 3) (c 1)) means there is a link from ato b of weight 3 and a link from a to c of weight 1. Assuming thatthe weights are positive, an underestimate of the remainingdistance from a source node to the goal node can be computed as theminimum weight of the outgoing arcs from the source node. Forexample, in the graph given above, the underestimate of theremaining distance from node D to the goal G is 1 (the minimum ofoutgoing weights 1,2,1,2) Write a function, hillClimb, of threearguments: the source node, the goal node and the graph. Thefunction would then perform a hill climbing search to find theshortest path from the given source node to the given goal node.For example, if we call: >(hillClimb ‘a ‘g graph) It shouldreturn the path from a to g, as: (a c d g)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply