Advertisement
Guest User

Untitled

a guest
Jul 20th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. /*
  2. See GraphClass.h (http://pastebin.com/dgAgTq8D)
  3. and GraphClass.cpp (http://pastebin.com/atjfYmhT )
  4.  
  5. */
  6.  
  7. #include <iostream>
  8. #include <queue>
  9. #include <list>
  10. #include <cstdbool>
  11. #include "GraphClass.h"
  12. //using namespace std;
  13.  
  14.  int main(int argc, char const *argv[])
  15. {
  16.     // creating graph of 54 vertices
  17.     Graph g(4);
  18.     g.addEdge(0, 1);
  19.     g.addEdge(0, 2);
  20.     g.addEdge(1, 2);
  21.     g.addEdge(2, 0);
  22.     g.addEdge(2, 3);
  23.     g.addEdge(3, 3);
  24.  
  25.     cout << "Following is Breadth First Traversal (starting from vertex 2) \n";
  26.     g.BFS(2);
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement