My Project
Graph.h
1 
9 #ifndef GRAPH_H
10 #define GRAPH_H
11 
12 #include"Utils.h"
13 #include"Node.h"
14 
15 enum GraphType {
16  DIRECTED, UNDIRECTED
17 };
18 
19 class Graph {
20 
22  GraphType graph_type;
23 
24  std::vector<Node*> nodes;
25  std::vector<std::vector<Node*> > edges;
26  std::map<std::string, Node*> social_network;
27 
29  void check_node(Node& node) const;
30 
31 public:
32 
33  Graph();
34  Graph(GraphType type);
35  virtual ~Graph();
36 
38  uint node_count() const;
39 
41  void insert_node(Node* node);
42 
44  void insert_edge(Node* node1, Node* node2);
45 
47  std::vector<Node*>& get_nodes();
48 
50  std::vector<Node*>& get_edges(Node& node);
51 
55  void reset();
56 
57  int time;
58 
60  std::stack<Node*> stack;
61  std::vector<std::vector<Node*> > ctc;
62 
63  void print_ctc() const;
64 
66  std::stack<std::pair<int, int> > edges_stack;
67  std::vector<Node*> articulation_points;
68  std::vector<std::pair<Node*, Node*> > critical_edges;
69 
71  friend std::istream& operator>>(std::istream& in, Graph& node);
72  friend std::ostream& operator<<(std::ostream& out, Graph& node);
73 };
74 
75 #endif
void insert_node(Node *node)
Definition: Graph.cpp:31
Definition: Node.h:14
void reset()
Definition: Graph.cpp:51
Definition: Graph.h:19
friend std::istream & operator>>(std::istream &in, Graph &node)
Definition: Graph.cpp:119
void check_node(Node &node) const
Definition: Graph.cpp:70
GraphType graph_type
Definition: Graph.h:22
uint node_count() const
Definition: Graph.cpp:27
Graph()
Definition: Graph.cpp:11
std::vector< Node * > & get_edges(Node &node)
Definition: Graph.cpp:46
std::vector< Node * > & get_nodes()
Definition: Graph.cpp:42
std::stack< std::pair< int, int > > edges_stack
Definition: Graph.h:66
void insert_edge(Node *node1, Node *node2)
Definition: Graph.cpp:37
std::stack< Node * > stack
Definition: Graph.h:60