Skip to content

Commit

Permalink
[centrality] added comments to driver code
Browse files Browse the repository at this point in the history
  • Loading branch information
bedupako12mas committed Aug 12, 2024
1 parent 9d3e44c commit c9a445d
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions include/metrics/betweennessCentrality.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,45 @@ pgr_betweennesscentrality(
template <class G>
class Pgr_metrics {
public:
/** @name betweennessCentrality
* @{
*
*/

/** @brief betweennessCentrality function
*
* It does all the processing and returns the results.
*
* @param graph the graph containing the edges
*
* @see [boost::brandes_betweenness_centrality]
* (https://www.boost.org/doc/libs/1_85_0/libs/graph/doc/betweenness_centrality.html)
*/
using Graph = typename G::B_G;
using Vertex = typename G::V;
using V = typename G::V;
using E = typename G::E;
typedef typename boost::graph_traits<Graph>::directed_category directed_category;

void betweennessCentrality(
const G &graph,
size_t &result_tuple_count,
IID_t_rt **postgres_rows ) {
std::vector<double> centrality(boost::num_vertices(graph.graph), 0.0);

// stores the centrality values for all vertices of the graph
auto centrality_map = boost::make_iterator_property_map(centrality.begin(),
boost::get(boost::vertex_index, graph.graph));


/* abort in case of an interruption occurs (e.g. the query is being cancelled) */
CHECK_FOR_INTERRUPTS();
boost::brandes_betweenness_centrality(
graph.graph,
centrality_map);

centrality_map
);
if (boost::num_vertices(graph.graph) > 2) {
boost::relative_betweenness_centrality(
graph.graph,
centrality_map);
centrality_map
);
}

generate_results(graph, centrality, result_tuple_count, postgres_rows);
Expand Down

0 comments on commit c9a445d

Please sign in to comment.