Revision 33e5ad95 custompackages/graphparser/src/centrality.h
custompackages/graphparser/src/centrality.h  

98  98  
99  99 
// get communication intensity from traffic_matrix 
100  100 
// dependency_type communication_intensity = dependency_type(1); 
101 
dependency_type communication_intensity = get_traffic_matrix_value(g, traffic_matrix, w, *s); 

101 
dependency_type communication_intensity = get_traffic_matrix_value(g, traffic_matrix, w, *s); // denoted as h in the paper


102  102 
put(dependency, w, communication_intensity + get(dependency, w)); 
103  103  
104 
update_centrality(centrality, *s, communication_intensity); // the number of times s is a source 

105  
104  106 
dependency_type factor = dependency_type(get(dependency, w)) 
105  107 
/ dependency_type(get(path_count, w)); 
106  108  
...  ...  
348  350 
typename VertexIndexMap, typename ShortestPaths> 
349  351  
350  352 
void 
351 
brandes_betweenness_centrality_targets_inclusion_impl(const Graph& g,


352 
bool targets_inclusion,


353 
brandes_betweenness_centrality_endpoints_inclusion_impl(const Graph& g,


354 
bool endpoints_inclusion,


353  355 
CentralityMap centrality, // C_B 
354  356 
EdgeCentralityMap edge_centrality_map, 
355  357 
IncomingMap incoming, // P 
...  ...  
386  388 
shortest_paths(g, *s, ordered_vertices, incoming, distance, 
387  389 
path_count, vertex_index); 
388  390  
391 
// cout << ordered_vertices.size() << endl; 

392 
update_centrality(centrality, *s, ordered_vertices.size()  1); // number of times *s is a source 

393  
389  394 
while (!ordered_vertices.empty()) { 
390  395 
vertex_descriptor w = ordered_vertices.top(); 
391  396 
ordered_vertices.pop(); 
...  ...  
407  412 
} 
408  413  
409  414 
if (w != *s) { 
410 
if (targets_inclusion) {


415 
if (endpoints_inclusion) {


411  416 
update_centrality(centrality, w, get(dependency, w) + dependency_type(1)); 
412  417 
} 
413  418 
else { 
...  ...  
434  439 
typename DependencyMap, typename PathCountMap, 
435  440 
typename VertexIndexMap> 
436  441 
void 
437 
brandes_betweenness_centrality_targets_inclusion(const Graph& g,


438 
bool targets_inclusion,


442 
brandes_betweenness_centrality_endpoints_inclusion(const Graph& g,


443 
bool endpoints_inclusion,


439  444 
CentralityMap centrality, // C_B 
440  445 
EdgeCentralityMap edge_centrality_map, 
441  446 
IncomingMap incoming, // P 
...  ...  
447  452 
{ 
448  453 
detail::graph::brandes_unweighted_shortest_paths shortest_paths; 
449  454  
450 
detail::graph::brandes_betweenness_centrality_targets_inclusion_impl(g,


451 
targets_inclusion,


455 
detail::graph::brandes_betweenness_centrality_endpoints_inclusion_impl(g,


456 
endpoints_inclusion,


452  457 
centrality, 
453  458 
edge_centrality_map, 
454  459 
incoming, distance, 
...  ...  
463  468 
typename DependencyMap, typename PathCountMap, 
464  469 
typename VertexIndexMap, typename WeightMap> 
465  470 
void 
466 
brandes_betweenness_centrality_targets_inclusion(const Graph& g,


467 
bool targets_inclusion,


471 
brandes_betweenness_centrality_endpoints_inclusion(const Graph& g,


472 
bool endpoints_inclusion,


468  473 
CentralityMap centrality, // C_B 
469  474 
EdgeCentralityMap edge_centrality_map, 
470  475 
IncomingMap incoming, // P 
...  ...  
478  483 
detail::graph::brandes_dijkstra_shortest_paths<WeightMap> 
479  484 
shortest_paths(weight_map); 
480  485  
481 
detail::graph::brandes_betweenness_centrality_targets_inclusion_impl(g,


482 
targets_inclusion,


486 
detail::graph::brandes_betweenness_centrality_endpoints_inclusion_impl(g,


487 
endpoints_inclusion,


483  488 
centrality, 
484  489 
edge_centrality_map, 
485  490 
incoming, distance, 
...  ...  
493  498 
typename CentralityMap, typename EdgeCentralityMap, 
494  499 
typename WeightMap, typename VertexIndexMap> 
495  500 
void 
496 
brandes_betweenness_centrality_targets_inclusion_dispatch2(const Graph& g,


497 
bool targets_inclusion,


501 
brandes_betweenness_centrality_endpoints_inclusion_dispatch2(const Graph& g,


502 
bool endpoints_inclusion,


498  503 
CentralityMap centrality, 
499  504 
EdgeCentralityMap edge_centrality_map, 
500  505 
WeightMap weight_map, 
...  ...  
516  521 
std::vector<centrality_type> dependency(V); 
517  522 
std::vector<degree_size_type> path_count(V); 
518  523  
519 
brandes_betweenness_centrality_targets_inclusion(


524 
brandes_betweenness_centrality_endpoints_inclusion(


520  525 
g, 
521 
targets_inclusion,


526 
endpoints_inclusion,


522  527 
centrality, edge_centrality_map, 
523  528 
make_iterator_property_map(incoming.begin(), vertex_index), 
524  529 
make_iterator_property_map(distance.begin(), vertex_index), 
...  ...  
533  538 
typename CentralityMap, typename EdgeCentralityMap, 
534  539 
typename VertexIndexMap> 
535  540 
void 
536 
brandes_betweenness_centrality_targets_inclusion_dispatch2(const Graph& g,


537 
bool targets_inclusion,


541 
brandes_betweenness_centrality_endpoints_inclusion_dispatch2(const Graph& g,


542 
bool endpoints_inclusion,


538  543 
CentralityMap centrality, 
539  544 
EdgeCentralityMap edge_centrality_map, 
540  545 
VertexIndexMap vertex_index) 
...  ...  
555  560 
std::vector<centrality_type> dependency(V); 
556  561 
std::vector<degree_size_type> path_count(V); 
557  562  
558 
brandes_betweenness_centrality_targets_inclusion(


563 
brandes_betweenness_centrality_endpoints_inclusion(


559  564 
g, 
560 
targets_inclusion,


565 
endpoints_inclusion,


561  566 
centrality, edge_centrality_map, 
562  567 
make_iterator_property_map(incoming.begin(), vertex_index), 
563  568 
make_iterator_property_map(distance.begin(), vertex_index), 
...  ...  
567  572 
} 
568  573  
569  574 
template<typename WeightMap> 
570 
struct brandes_betweenness_centrality_targets_inclusion_dispatch1


575 
struct brandes_betweenness_centrality_endpoints_inclusion_dispatch1


571  576 
{ 
572  577 
template<typename Graph, 
573  578 
typename CentralityMap, 
574  579 
typename EdgeCentralityMap, typename VertexIndexMap> 
575  580 
static void 
576  581 
run(const Graph& g, 
577 
bool targets_inclusion,


582 
bool endpoints_inclusion,


578  583 
CentralityMap centrality, 
579  584 
EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, 
580  585 
WeightMap weight_map) 
581  586 
{ 
582 
brandes_betweenness_centrality_targets_inclusion_dispatch2(g,


583 
targets_inclusion,


587 
brandes_betweenness_centrality_endpoints_inclusion_dispatch2(g,


588 
endpoints_inclusion,


584  589 
centrality, edge_centrality_map, 
585  590 
weight_map, vertex_index); 
586  591 
} 
587  592 
}; 
588  593  
589  594 
template<> 
590 
struct brandes_betweenness_centrality_targets_inclusion_dispatch1<param_not_found>


595 
struct brandes_betweenness_centrality_endpoints_inclusion_dispatch1<param_not_found>


591  596 
{ 
592  597 
template<typename Graph, 
593  598 
typename CentralityMap, 
594  599 
typename EdgeCentralityMap, typename VertexIndexMap> 
595  600 
static void 
596  601 
run(const Graph& g, 
597 
bool targets_inclusion,


602 
bool endpoints_inclusion,


598  603 
CentralityMap centrality, 
599  604 
EdgeCentralityMap edge_centrality_map, VertexIndexMap vertex_index, 
600  605 
param_not_found) 
601  606 
{ 
602 
brandes_betweenness_centrality_targets_inclusion_dispatch2(g,


603 
targets_inclusion,


607 
brandes_betweenness_centrality_endpoints_inclusion_dispatch2(g,


608 
endpoints_inclusion,


604  609 
centrality, edge_centrality_map, 
605  610 
vertex_index); 
606  611 
} 
...  ...  
610  615  
611  616 
template<typename Graph, typename Param, typename Tag, typename Rest> 
612  617 
void 
613 
brandes_betweenness_centrality_targets_inclusion(const Graph& g,


614 
bool targets_inclusion,


618 
brandes_betweenness_centrality_endpoints_inclusion(const Graph& g,


619 
bool endpoints_inclusion,


615  620 
const bgl_named_params<Param,Tag,Rest>& params 
616  621 
BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag)) 
617  622 
{ 
618  623 
typedef bgl_named_params<Param,Tag,Rest> named_params; 
619  624  
620  625 
typedef typename get_param_type<edge_weight_t, named_params>::type ew; 
621 
detail::graph::brandes_betweenness_centrality_targets_inclusion_dispatch1<ew>::run(


626 
detail::graph::brandes_betweenness_centrality_endpoints_inclusion_dispatch1<ew>::run(


622  627 
g, 
623 
targets_inclusion,


628 
endpoints_inclusion,


624  629 
choose_param(get_param(params, vertex_centrality), 
625  630 
dummy_property_map()), 
626  631 
choose_param(get_param(params, edge_centrality), 
Also available in: Unified diff