Guest User

Untitled

a guest
May 16th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include "Edge.h"
  2.  
  3.  
  4. Edge :: Edge (Node *adjacent, int weight)
  5. {
  6.     this->adjacent = adjacent;
  7.     this->weight = weight;
  8. }
  9.  
  10.  
  11. Edge :: ~Edge()
  12. {
  13.     this->adjacent = NULL;
  14. }
  15.  
  16.  
  17.  
  18. int Edge :: getWeight()
  19. {
  20.     return this->weight;
  21. }
  22.  
  23.  
  24.  
  25. Node *Edge :: getAdjacent()
  26. {
  27.     return this->adjacent;
  28. }
  29.  
  30.  
  31.  
  32.  
  33. bool operator== (Edge &l, Edge &r)
  34. {
  35.     if (l.weight == r.weight && *(l.adjacent) == *(r.adjacent))
  36.         return true;
  37.     return false;
  38. }
  39.  
  40.  
  41.  
  42. ostream& operator<< (ostream &stream, const Edge &edge)
  43. {
  44.     stream << "(" << (edge.adjacent)->getLabel() << "," << edge.weight << ")";
  45. }
Advertisement
Add Comment
Please, Sign In to add comment