Revision 437fd680 custompackages/graph-parser/src/graph_manager.h

View differences:

custompackages/graph-parser/src/graph_manager.h
14 14
    typedef boost::edge_bundle_type<Graph>::type EdgeProperties; // aka Link in common.h
15 15
    typedef std::map<std::string, Vertex> NameVertexMap;
16 16

  
17
    // CONSTRUCTOR
17 18
    GraphManager(); // constructor
18 19
    GraphManager(const GraphManager& other); // copy constructor
19 20
    GraphManager& operator=(GraphManager& rhs); // assignment operator
20 21
    // check out more here: http://www.cplusplus.com/articles/y8hv0pDG/
21 22

  
23
    // GETTERS
24
    const VertexIndexPMap& v_index_pmap() const;
25
    const EdgeIndexPMap& e_index_pmap() const;
26
    NameToIntMap const& v_id_index_map() const;
27

  
28
    // UPDATE GRAPH
22 29
    void AddEdge(VertexProperties vp1, VertexProperties vp2, EdgeProperties ep);
30
    void ResetVerticesAndEdgesIndexMap();
31

  
32
    // HELPERS
23 33
    bool vertex_existed(string s);
24 34
    const Vertex& get_vertex_from_id(string s);
35
    int get_index_from_id(string s);
25 36

  
26
    StringSet vertices_id();
27

  
28
    void ResetVerticesAndEdgesIndexMap();
29 37

  
30
    // Function to print results
38
    // OUTPUTTING THE RESULT
31 39
    // TODO: checkout utility.h, I can't overload << operator to output
32 40
    // the correct result. Therefore, I use print() ufnction as a replacement.
33
    void print_v_index_map();
34
    void print_e_index_map();
35

  
36
    // Getter
37
    const VertexIndexMap& v_index_map() const;
38
    const EdgeIndexMap& e_index_map() const;
39

  
40
    // Output Operators
41
    void print();
42
    void print_v_index_pmap();
43
    void print_e_index_pmap();
41 44
    friend std::ostream& operator<<(std::ostream& os, const GraphManager& gm);
42 45

  
46
    // Variables
43 47
    Graph g_;
44 48
private:
49
    void reset_v_index_pmap();
45 50
    void reset_v_id_vertex_map();
46
    void reset_v_index_map();
47
    void reset_e_index_map();
48
    void update_v_index_map(Vertex new_vertex);
49
    void update_e_index_map(Edge new_edge);
51
    void reset_v_id_index_map(); // must be called after reset_v_index_pmap()
52

  
53
    void reset_e_index_pmap();
54
    void update_v_index_pmap(Vertex new_vertex);
55
    void update_e_index_pmap(Edge new_edge);
50 56

  
57
    // VARIABLES
51 58
    NameVertexMap v_id_vertex_map_;
59
    NameToIntMap v_id_index_map_;
52 60

  
53
    // VertexIndexMap - since we use listS instead of vecS, this one maps each vertex to an id
61
    // VertexIndexPMap - since we use listS instead of vecS in Graph, this one maps each vertex to an id
54 62
    VertexIndexStdMap v_index_std_map_;
55
    VertexIndexMap v_index_map_; //
63
    VertexIndexPMap v_index_pmap_; //
56 64

  
57
    // EdgeIndexMap - boost will return the component id that each edge in the graph belongs to.
65
    // EdgeIndexPMap - boost will return the component id that each edge in the graph belongs to.
58 66
    EdgeIndexStdMap e_index_std_map_;
59
    EdgeIndexMap e_index_map_;
67
    EdgeIndexPMap e_index_pmap_;
60 68
};
61 69

  
62 70
#endif //GRAPH_PARSER_GRAPH_MANAGER_H

Also available in: Unified diff