Guest User

Untitled

a guest
Mar 22nd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. struct Node
  2. {
  3. public:
  4. Node(int x, Node* node);
  5. private:
  6. int mX;
  7. Node* mNode;
  8. };
  9.  
  10. #include <list>
  11. using namespace std;
  12.  
  13. struct Edge;
  14.  
  15. struct Node
  16. {
  17. public:
  18. Node() : m_id(-1) {}
  19. Node(int id) : m_id(id) {}
  20.  
  21. int id() { return m_id; }
  22.  
  23. list<Edge*>& get_Edges() { return m_Edges; }
  24.  
  25. private:
  26. int m_id;
  27. list<Edge*> m_Edges;
  28. };
  29.  
  30. struct Edge
  31. {
  32. public:
  33. Edge() : m_id(-1), m_weight(0) {}
  34. Edge(const int id, const int weight) : m_id(id), m_weight(weight) {}
  35.  
  36. int id() const { return m_id; }
  37.  
  38. int get_weight() const { return m_weight; }
  39. void set_weight(int weight) { m_weight = weight; }
  40.  
  41. Node* get_first_node() { return m_first_node; }
  42. Node* get_second_node() { return m_second_node; }
  43.  
  44. void set_first_node(Node* node) { m_first_node = node; }
  45. void set_second_node(Node* node) { m_second_node = node; }
  46.  
  47. private:
  48. int m_id;
  49. int m_weight;
  50. Node* m_first_node;
  51. Node* m_second_node;
  52. };
Add Comment
Please, Sign In to add comment