indigoX
paths.hpp
Go to the documentation of this file.
1 #include "../../utils/fwd_declares.hpp"
2 
3 #include <map>
4 #include <vector>
5 
6 #ifndef INDIGOX_ALGORITHM_GRAPH_PATHS_HPP
7 #define INDIGOX_ALGORITHM_GRAPH_PATHS_HPP
8 
9 namespace indigox::algorithm {
10 
24  template <class V, class E, class S, class D, class VP, class EP>
25  std::vector<E> ShortestPath(graph::BaseGraph<V, E, S, D, VP, EP> &G, V source,
26  V target);
27 
38  template <class V, class E, class S, class D, class VP, class EP>
39  void AllSimplePaths(graph::BaseGraph<V, E, S, D, VP, EP> &G, V source,
40  V target, std::vector<std::vector<E>> &paths,
41  int64_t limit = -1);
42 
43  template <class V> struct TraversalResults {
44  using OrderType = typename std::vector<V>;
45  using PredType = typename std::map<V, V>;
46  using LengthType = typename std::map<V, int32_t>;
51 
53  V &far)
54  : discover_order(order), predecessors(pred), path_lengths(length),
55  furthest(far) {}
56  };
57 
67  template <class V, class E, class S, class D, class VP, class EP>
69  V source = V(), int64_t limit = -1);
70 
71  template <class V, class E, class S, class D, class VP, class EP>
72  TraversalResults<V>
74  int64_t limit = -1);
75 } // namespace indigox::algorithm
76 
77 #endif /* INDIGOX_ALGORITHM_GRAPH_PATHS_HPP */
Definition: access.hpp:7
TraversalResults< V > BreadthFirstSearch(graph::BaseGraph< V, E, S, D, VP, EP > &G, V source=V(), int64_t limit=-1)
V furthest
Definition: paths.hpp:50
PredType predecessors
Definition: paths.hpp:48
typename std::vector< V > OrderType
Definition: paths.hpp:44
TraversalResults< V > DepthFirstSearch(graph::BaseGraph< V, E, S, D, VP, EP > &G, V source=V(), int64_t limit=-1)
Perform a breadth first search of G.
std::vector< E > ShortestPath(graph::BaseGraph< V, E, S, D, VP, EP > &G, V source, V target)
Find the shortest path between two vertices.
TraversalResults(OrderType &order, PredType &pred, LengthType &length, V &far)
Definition: paths.hpp:52
OrderType discover_order
Definition: paths.hpp:47
typename std::map< V, int32_t > LengthType
Definition: paths.hpp:46
void AllSimplePaths(graph::BaseGraph< V, E, S, D, VP, EP > &G, V source, V target, std::vector< std::vector< E >> &paths, int64_t limit=-1)
Find all the simple paths between two vertices.
Definition: paths.hpp:43
LengthType path_lengths
Definition: paths.hpp:49
Template base class for all graphs used in the indigoX library.
Definition: base_graph.hpp:56
typename std::map< V, V > PredType
Definition: paths.hpp:45