Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. /***
  2.  *       ___   ___   _____   ___   ___   ___   ___     ___    __    _   ____
  3.  *      / __| | __| |_   _| | __| |_ _| | __| | _ \   |_  )  /  \  / | |__  |
  4.  *     | (__  | _|    | |   | _|   | |  | _|  |  _/    / /  | () | | |   / /
  5.  *      \___| |___|   |_|   |___| |___| |___| |_|     /___|  \__/  |_|  /_/
  6.  *
  7.  * TEI of Epirus - Department of Computer Engineering
  8.  * Gogos Christos - Arta 2017
  9.  */
  10.  
  11. #include "lab02_graph.hpp"
  12.  
  13. int main(int argc, char **argv) {
  14.   double sum=0;
  15.   struct di_graph graph { };
  16.   if (argc != 2) {
  17.     cout << "Wrong number of arguments" << endl;
  18.     exit(-1);
  19.   }
  20.   string fn{argv[1]};
  21.   graph = read_data(fn);
  22.   print_graph_info(graph);
  23.   for (int i = 0; i < graph.V; ++i){
  24.     string v = get_vertex_label(graph,i);
  25.     sum+= get_heuristic(graph, v);
  26.   }
  27.   double mo = (double)sum / (double)graph.V;
  28.   cout<<"Average: "<<mo<<endl;
  29.   free_memory(graph);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement