GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
AdjacencyList.h
1 #ifndef ADJACENCY_LIST_H
2 #define ADJACENCY_LIST_H
3 
4 #include <vector>
5 #include <utility> // std::pair
6 #include <map>
7 #include <set>
8 
9 class AdjacencyList {
10  public:
11  AdjacencyList();
12  ~AdjacencyList();
13  unsigned int add_node();
14  void add_edge(unsigned int u, unsigned int v);
15  std::vector<std::pair<unsigned int, unsigned int> >& edge_list();
16  std::set<unsigned int>* adjacent_vertices(unsigned int u);
17  unsigned int num_vertices();
18  unsigned int num_edges();
19  unsigned int degree(unsigned int u);
20 
21  private:
22  unsigned int num_vertices_;
23  unsigned int num_edges_;
24  unsigned int current_vertex_number_;
25 
26  // adjacency list
27  std::vector<std::set<unsigned int> > adj_list;
28 
29  // list of all edges in this graph
30  std::vector<std::pair<unsigned int, unsigned int> > edge_list_;
31 };
32 
33 #endif
Definition: AdjacencyList.h:9