1 // 2 // vertex.h 3 // 4 5 #ifndef __VERTEX_H__ 6 #define __VERTEX_H__ 7 8 #include "wx/string.h" 9 10 #include <iostream> 11 #include <vector> 12 13 class Edge; 14 15 16 class Vertex 17 { 18 private: 19 std::vector<Edge *> edges; // Edges adjacent to this vertex 20 21 public: 22 23 typedef std::vector<Edge *>::iterator e_iterator; 24 typedef std::vector<Edge *>::const_iterator e_const_iterator; 25 26 wxString label; 27 int x; 28 int y; 29 bool selected; 30 int selection_colour; 31 Vertex *next; 32 long mark; 33 34 Vertex *map_to; // speed up for graph cloning 35 36 37 Vertex (wxString &lbl, int _x, int _y); 38 Vertex (char *lbl, int _x, int _y); 39 Vertex (const Vertex &other); 40 41 unsigned int degree () const; 42 unsigned int indegree () const; 43 unsigned int outdegree () const; 44 45 Vertex *opposite (const Edge *e) const; 46 47 e_iterator e_begin (); 48 e_iterator e_end (); 49 e_const_iterator e_begin () const; 50 e_const_iterator e_end () const; 51 void hook (Edge *e); 52 void unhook (Edge *e); 53 54 Vertex &operator= (const Vertex &other); 55 friend std::ostream &operator<< (std::ostream &o, const Vertex &v); 56 }; 57 58 #endif // __VERTEX_H__ 59