|
GraphLibrary
0.0.1
A simple library that implements various graph algorithms.
|
Class computes that Shortest Paths for all pairs of nodes in the graph using the Floyd-Warshall algorithm. More...
#include <FloydWarshall.hpp>
Public Member Functions | |
| FloydWarshall () | |
| Default constructor. More... | |
| FloydWarshall (const Graph &graph) | |
| Computation Constructor. More... | |
| FloydWarshall (const FloydWarshall &)=default | |
| Copy constructor. More... | |
| FloydWarshall (FloydWarshall &&) noexcept=default | |
| Move constructor. More... | |
| FloydWarshall & | operator= (const FloydWarshall &)=default |
| Copy assignment. More... | |
| FloydWarshall & | operator= (FloydWarshall &&) noexcept=default |
| Move assignment. More... | |
| ~FloydWarshall ()=default | |
| Default destructor. More... | |
| void | compute (const Graph &graph) |
| Computation. This is where the shortest distances and the successors of each node pair gets computed. More... | |
| bool | hasNegativePath () const |
| Checks whether the input graph has negative cycles. More... | |
| Distance< val_t > | pathLength (const idx_t src, const idx_t dest) const |
| Computes the shortest path length from 'src' to 'dest'. More... | |
| std::pair< bool, idx_list_t > | getPath (const idx_t src, const idx_t dest) const |
| Computes the node sequence that represents the shortest path from 'src' to 'dest'. More... | |
| Graph | getSPT (const idx_t src) const |
| Returns a graph that only contains the edges of the SPT (Shortest Path Tree) starting at 'src'. More... | |
| double | closenessCentrality (const idx_t id) const |
| Computes the closeness centrality of node 'id'. More... | |
| double | harmonicCentrality (const idx_t id) const |
| Computes the harmonic centrality of node 'id'. More... | |
Private Types | |
| using | idx_t = typename Graph::idx_t |
| using | val_t = typename Graph::val_t |
| using | distance_matrix_t = std::vector< Distance< val_t >> |
| using | idx_list_t = typename Graph::idx_list_t |
Private Attributes | |
| bool | isInitialized_ = false |
| Boolean storing initialization status. More... | |
| std::pair< bool, idx_t > | negativePath_ |
| Boolean storing info on negative path in graph. More... | |
| Graph | graph_ |
| Reference to graph. More... | |
| distance_matrix_t | dist_ |
| Shortest Path lengths. More... | |
| idx_list_t | next_ |
| Shortest Path successors. More... | |
Class computes that Shortest Paths for all pairs of nodes in the graph using the Floyd-Warshall algorithm.
|
private |
|
private |
|
private |
|
private |
| gl::algorithm::FloydWarshall< Graph >::FloydWarshall | ( | ) |
Default constructor.
|
explicit |
Computation Constructor.
|
default |
Copy constructor.
|
defaultnoexcept |
Move constructor.
|
default |
Default destructor.
|
default |
Copy assignment.
|
defaultnoexcept |
Move assignment.
| void gl::algorithm::FloydWarshall< Graph >::compute | ( | const Graph & | graph | ) |
Computation. This is where the shortest distances and the successors of each node pair gets computed.
| graph | Input graph on which the shortest paths will be computed. |
| bool gl::algorithm::FloydWarshall< Graph >::hasNegativePath | ( | ) | const |
Checks whether the input graph has negative cycles.
| Distance< typename Graph::val_t > gl::algorithm::FloydWarshall< Graph >::pathLength | ( | const idx_t | src, |
| const idx_t | dest | ||
| ) | const |
Computes the shortest path length from 'src' to 'dest'.
| src | Starting point of shortest path. |
| dest | End point of shortest path. |
| std::pair< bool, typename Graph::idx_list_t > gl::algorithm::FloydWarshall< Graph >::getPath | ( | const idx_t | src, |
| const idx_t | dest | ||
| ) | const |
Computes the node sequence that represents the shortest path from 'src' to 'dest'.
| src | Starting point of shortest path. |
| dest | End point of shortest path. |
| Graph gl::algorithm::FloydWarshall< Graph >::getSPT | ( | const idx_t | src | ) | const |
Returns a graph that only contains the edges of the SPT (Shortest Path Tree) starting at 'src'.
| [in] | src | source node of SPT graph. |
| double gl::algorithm::FloydWarshall< Graph >::closenessCentrality | ( | const idx_t | id | ) | const |
Computes the closeness centrality of node 'id'.
| [in] | id | Node whose closeness centrality is to be computed |
| double gl::algorithm::FloydWarshall< Graph >::harmonicCentrality | ( | const idx_t | id | ) | const |
Computes the harmonic centrality of node 'id'.
| [in] | id | Node whose harmonic centrality is to be computed |
|
private |
Boolean storing initialization status.
|
private |
Boolean storing info on negative path in graph.
|
private |
Reference to graph.
|
private |
Shortest Path lengths.
|
private |
Shortest Path successors.