|
|
| Network ()=default |
| | Construct a new empty Network object.
|
|
auto const & | nodes () const noexcept |
| | Get the nodes as an unordered map.
|
|
auto const & | edges () const noexcept |
| | Get the edges as an unordered map.
|
|
auto | nNodes () const noexcept |
| | Get the number of nodes.
|
|
auto | nEdges () const noexcept |
| | Get the number of edges.
|
template<typename TNode = node_t, typename... TArgs>
requires (std::is_base_of_v<node_t, TNode> && std::constructible_from<TNode, TArgs...>) |
| void | addNode (TArgs &&... args) |
template<typename TNode = node_t>
requires (std::is_base_of_v<node_t, TNode>) |
| void | addNDefaultNodes (std::size_t const n) |
template<typename TEdge = edge_t, typename... TArgs>
requires (std::is_base_of_v<edge_t, TEdge> && std::constructible_from<TEdge, TArgs...>) |
| void | addEdge (TArgs &&... args) |
| virtual void | setEdgeWeight (std::string_view const strv_weight, std::optional< double > const threshold=std::nullopt)=0 |
| const auto & | node (Id const nodeId) const |
| | Get a node by id.
|
| auto & | node (Id const nodeId) |
| | Get a node by id.
|
| const auto & | edge (Id const edgeId) const |
| | Get an edge by id.
|
| auto & | edge (Id const edgeId) |
| | Get an edge by id.
|
|
edge_t & | edge (Id const source, Id const target) const |
template<typename TNode>
requires (std::is_base_of_v<node_t, TNode>) |
| auto & | node (Id const nodeId) |
| | Get a node by id and cast it to a derived type.
|
template<typename TEdge>
requires (std::is_base_of_v<edge_t, TEdge>) |
| auto & | edge (Id const edgeId) |
| | Get an edge by id and cast it to a derived type.
|
| PathCollection | allPathsTo (Id const targetId) const |
| | Perform a global Dijkstra search to a target node from all other nodes in the graph.
|
| PathCollection | shortestPath (Id const sourceId, Id const targetId) const |
| | Find the shortest path between two nodes using Dijkstra's algorithm.
|
|
void | computeBetweennessCentralities () |
| | Compute node weighted betweenness centralities using Brandes' algorithm.
|
|
void | computeEdgeBetweennessCentralities () |
| | Compute edge weighted betweenness centralities using Brandes' algorithm.
|
| void | computeEdgeKBetweennessCentralities (std::size_t const K) |
| | Compute edge betweenness centralities using Yen's K-shortest paths.
|
template<typename node_t, typename edge_t>
requires (std::is_base_of_v<
Node, node_t> && std::is_base_of_v<
Edge, edge_t>)
| void dsf::Network< node_t, edge_t >::computeEdgeKBetweennessCentralities |
( |
std::size_t const | K | ) |
|
Compute edge betweenness centralities using Yen's K-shortest paths.
For every ordered source–target pair (s, t) with s ≠ t the method finds up to K loopless shortest paths using Yen's algorithm. Each edge e that appears in at least one of those paths receives an increment equal to the number of those K paths that traverse it. After all pairs are processed the raw counts are normalised by (N−1)·(N−2), the number of ordered pairs in a directed graph of N nodes (same denominator used by the standard Brandes formulation).
The computation is parallelised over source nodes with Intel TBB: each thread maintains its own accumulator map, which are merged sequentially once all threads finish.
- Parameters
-
| K | Maximum number of shortest paths per (s, t) pair. K = 1 reproduces single-shortest-path betweenness. |