Question: the above code is for a graph having numeric data write a cpp code which can have string data as graph nodes and int weight

 the above code is for a graph having numeric data writea cpp code which can have string data as graph nodes and

the above code is for a graph having numeric data write a cpp code which can have string data as graph nodes and int weight and give the lowest cost from strat node of string type to end goal

#include using namespace std; vector > graph; map, int> cost; vector uniform_cost_search(vector goal, int start) { vector answer; priority_queue > queue; for (int i = 0; i visited; int count = 0; while (queue.size() > e) { pair p = queue.top(); queue.pop(); p.first *= -1; if (find(goal.begin(), goal.end(), p.second) != goal.end()) { int index = find(goal.begin(), goal.end(),p-second) - goal.begin(); if (answer[index] == INT_MAX) count++; if (answer [index] > p.first) answer [index] = p.first; queue.pop(); if (count == goal.size()) return answer; if (visited[p.second] == @) for (int i = 0; i goal; goal.push_back (6); vector answer = uniform_cost_search(goal, e); cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!