Revision 20756421 custompackages/graph-parser/src/sub_component.cpp

View differences:

custompackages/graph-parser/src/sub_component.cpp
154 154
void SubComponent::update_traffic_matrix(string name_1, string name_2, int value) {
155 155
    int i1 = index_of_vertex_id(name_1);
156 156
    int i2 = index_of_vertex_id(name_2);
157
    cout << i1 << " " << i2 << " = " << value << endl;
157
    // cout << i1 << " " << i2 << " = " << value << endl;
158 158
    traffic_matrix_[i1][i2] = value;
159 159
    traffic_matrix_[i2][i1] = value; // because Traffic Matrix is symmetric
160 160
}
161 161

  
162
/* BETWEENNESS CENTRALITY */
163
void SubComponent::CalculateBetweennessCentrality() {
164
    initialize_betweenness_centrality();
165

  
166
    cout << "Mark 1" << endl;
167

  
168
    boost::brandes_betweenness_centrality(gm_.g_,
169
        boost::centrality_map(v_centrality_map_).vertex_index_map(
170
            gm_.v_index_map())
171
    );
172

  
173
    cout << "Mark 2" << endl;
174

  
175
    cout << "Vertex betweenness\n" << endl;
176
    for (int i = 0; i < num_of_vertices(); ++i) {
177
        cout << v_centrality_vec_.at(i) << endl;
178
    }
179
}
180

  
181
void SubComponent::initialize_betweenness_centrality() {
182
    v_centrality_vec_ = CentralityVec(num_of_vertices());
183
    v_centrality_map_ = CentralityMap(v_centrality_vec_.begin(), gm_.v_index_map());
184
}
185

  
162 186
/* HELPERS */
163 187
int SubComponent::num_of_vertices() {
164 188
    return boost::num_vertices(gm_.g_);

Also available in: Unified diff