write a program with the following capabilities. The program will prompt for the
ID: 3578890 • Letter: W
Question
write a program with the following capabilities. The program will prompt for the starting vertex in the range of 0-9999. The program will then prompt for a different vertex in the range of 0-9999. The program will then execute a shortest path Dijkstra algorithm. TO ACCESS THE DATASET; Please right click the sourcelink below and open the dataset. https://dl.dropboxusercontent.com/u/4309261/site%20links/datasets/datasets%20backup/M10000_P_toro.graph Here is the Example. Needs in C++ language please!!! //======================================================================= // Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) //======================================================================= #include #include #include #include #include #include #include using namespace boost; int main(int, char *[]) { typedef adjacency_list < listS, vecS, directedS, no_property, property < edge_weight_t, int > > graph_t; typedef graph_traits < graph_t >::vertex_descriptor vertex_descriptor; typedef std::pair Edge; const int num_nodes = 5; enum nodes { A, B, C, D, E }; char name[] = "ABCDE"; Edge edge_array[] = { Edge(A, C), Edge(B, B), Edge(B, D), Edge(B, E), Edge(C, B), Edge(C, D), Edge(D, E), Edge(E, A), Edge(E, B) }; int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 }; int num_arcs = sizeof(edge_array) / sizeof(Edge); graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes); property_map::type weightmap = get(edge_weight, g); std::vector p(num_vertices(g)); std::vector d(num_vertices(g)); vertex_descriptor s = vertex(A, g); dijkstra_shortest_paths(g, s, predecessor_map(boost::make_iterator_property_map(p.begin(), get(boost::vertex_index, g))). distance_map(boost::make_iterator_property_map(d.begin(), get(boost::vertex_index, g)))); std::cout << "distances and parents:" << std::endl; graph_traits < graph_t >::vertex_iterator vi, vend; for (boost::tie(vi, vend) = vertices(g); vi != vend; ++vi) { std::cout << "distance(" << name[*vi] << ") = " << d[*vi] << ", "; std::cout << "parent(" << name[*vi] << ") = " << name[p[*vi]] << std:: endl; } std::cout << std::endl; return EXIT_SUCCESS; }
Explanation / Answer
try: inp = raw_input("Please enter a score: ") score=float(inp) except: print "Please enter a score number between 0.0 and 9999" quit() if 0.0 = score >= 0.9 : print "A" elif 0.9 > score >= 0.8 : print "B" elif 0.8 > score >= 0.7 : print "C" elif 0.7 > score >= 0.6 : print "D" else : print "Your score number is not in the 0 - 9999range."Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.