![]() |
Mackey
V3.3
A C++ library for computing RO(G) graded homology
|
The shortest paths from a collection of sources to all points in a graph. More...
#include <Graph.hpp>
Public Types | |
typedef graph_t::node_t | node_t |
The node type. More... | |
typedef graph_t::neighborhood_t::const_iterator | edge_iter_t |
The iterator type used in the paths. More... | |
Public Member Functions | |
void | print_path (std::ostream &os, node_t i) const |
Print shortest path to node i to the output stream. More... | |
void | compute_with_root (node_t new_root) |
Compute all paths using given root. More... | |
bool | disconnected (node_t) const |
Checks if node is connected to any one of the sources. More... | |
Public Attributes | |
std::vector< std::vector< edge_iter_t > > | paths |
The shortest paths from the sources to all nodes. More... | |
std::vector< node_t > | root_per_path |
The source of each path. More... | |
Protected Member Functions | |
ShortestPaths (const graph_t &G) | |
Constructor computes the shortest paths given the graph. More... | |
Protected Attributes | |
const graph_t & | G |
Constant reference to the graph. More... | |
std::vector< size_t > | distance_policy |
The distance from a source to a node, computed by some policy (eg weight) More... | |
std::vector< std::pair< node_t, edge_iter_t > > | previous |
previous[i]=(node,edge) where node is 1 step closer to the source and edge connects node to i More... | |
node_t | root |
The root (source) of the graph being considered. More... | |
Friends | |
template<typename _graph , typename _pol > | |
std::ostream & | operator<< (std::ostream &, const ShortestPaths< _graph, _pol > &) |
The shortest paths from a collection of sources to all points in a graph.
graph_t | The type of directed graph |
policy_t | The policy that determines what we are minimizing against (eg total weight or number of color changes) |
Implementation of the Dijkstra algorithm (without decrease key), using the policy to determine if we should update the distance
Specify the policy via CRTP: have policy_t
inherit from this class Policy examples include MinLength and MinColorsLength
typedef graph_t::node_t node_t |
The node type.
typedef graph_t::neighborhood_t::const_iterator edge_iter_t |
The iterator type used in the paths.
|
protected |
Constructor computes the shortest paths given the graph.
void print_path | ( | std::ostream & | os, |
node_t | i | ||
) | const |
Print shortest path to node i to the output stream.
void compute_with_root | ( | node_t | new_root | ) |
Compute all paths using given root.
bool disconnected | ( | node_t | ) | const |
Checks if node is connected to any one of the sources.
true
if given node is disconnected and false
if connected
|
friend |
std::vector<std::vector<edge_iter_t> > paths |
The shortest paths from the sources to all nodes.
Stored as a sequence of iterators
std::vector<node_t> root_per_path |
The source of each path.
|
protected |
Constant reference to the graph.
|
protected |
The distance from a source to a node, computed by some policy (eg weight)
|
protected |
previous[i]=(node,edge) where node is 1 step closer to the source and edge connects node to i
|
protected |
The root (source) of the graph being considered.