Statistics
| Branch: | Revision:

root / custompackages / graph-parser / src / sub_component.h @ ee0dd796

History | View | Annotate | Download (1.82 KB)

1
//
2
// Created by quynh on 1/9/16.
3
//
4

    
5
// Problem with deep copy
6
// http://stackoverflow.com/questions/6955578/subtraction-and-intersection-of-two-vectors-of-pointers-in-c
7

    
8
#ifndef GRAPH_PARSER_SUB_COMPONENT_H
9
#define GRAPH_PARSER_SUB_COMPONENT_H
10

    
11
#include <boost/graph/betweenness_centrality.hpp>
12
#include <boost/graph/copy.hpp>
13
#include "common.h"
14

    
15
class SubComponent {
16
private:
17
    VertexVec art_points;
18
    VertexVec normal_vertices; // vertices that are not articulation points
19
    // std::vector<Vertex*> normal_vertices;
20
    // TODO: should this one be public?
21
    Graph subGraph;
22
    VertexMap weightMap;
23
    VertexMap weightReversedMap;
24

    
25
    StdVertexIndexMap v_index_std_map;
26
    VertexIndexMap v_index_map;
27
    vector<vector<int> > trafficMatrix;
28

    
29
    CentralityVec v_centrality_vec;
30
    CentralityMap v_centrality_map;
31

    
32
    // Traffic Matrix
33

    
34
    // Betweenness Centrality
35

    
36
public:
37
    SubComponent();
38
    // SubComponent(VertexVec art_points, Graph subGraph);
39
    SubComponent(const VertexVec art_points, const Graph subGraph);
40

    
41
    void init();
42

    
43
    // Getter
44
    VertexVec get_art_points();
45
    int num_vertices();
46

    
47
    // calculate Link Weight
48
    void _initialize_weight();
49
    void setWeight(Vertex art_point, int value);
50
    int getWeight(Vertex art_point);
51
    int getReversedWeight(Vertex art_point);
52
    void printWeight();
53
    void _find_vertices_with_unknown_weight(VertexVec& unknown_weight_vertices);
54

    
55
    // Traffic Matrix
56
    int getTrafficMatrix(Vertex v_1, Vertex v_2);
57
    void _initializeTrafficMatrix();
58
    int _indexOfVertex(Vertex v);
59
    void _setTrafficMatrix(Vertex v_1, Vertex v_2, int value);
60
    void _computeTrafficMatrix();
61

    
62
    // Betweenness Centrality
63
    void _initializeBetweennessCentrality();
64
    void findBetweennessCentrality();
65
    void printBetweennessCentrality();
66
};
67

    
68

    
69
#endif //GRAPH_PARSER_SUB_COMPONENT_H