Mackey  V3.3
A C++ library for computing RO(G) graded homology
Graph_Policies.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "Graph.hpp"
3 
6 
7 namespace mackey {
8 
11  char color;
12  unsigned char id;
13  bicolored_edge_with_id(char color, unsigned char id);
14  };
15 
17  std::ostream& operator << (std::ostream& os, const bicolored_edge_with_id& edge);
18 
19  //Prints graph in .dot format with named nodes if provided
20  template<typename neighborhood_t>
21  std::ostream& operator<<(std::ostream& os, const Graph<neighborhood_t>& G);
22 
23  //Prints graph in .dot format with named nodes if provided
24  template<typename graph_t, typename policy_t>
25  std::ostream& operator<<(std::ostream& os, const ShortestPaths<graph_t, policy_t>& D);
26 
28  template<typename graph_t>
29  class MinLength : public ShortestPaths<graph_t, MinLength<graph_t>> {
30  public:
31  MinLength(const graph_t& G);
32  private:
33  typedef typename graph_t::node_t node_t;
35  size_t path_length(node_t i) const;
36  template<typename iter>
37  bool check_and_update_policy(iter it, node_t current);
38  void initialize() {};
39  void clear() {};
40  friend class ShortestPaths<graph_t, MinLength<graph_t>>;
41  };
42 
44  template<typename graph_t>
45  class MinColorsLength : public ShortestPaths<graph_t, MinColorsLength<graph_t>> {
46  public:
47  MinColorsLength(const graph_t& G);
48  private:
49  typedef typename graph_t::node_t node_t;
51  std::vector<size_t> length;
52  size_t path_length(node_t i) const;
53  template<typename iter>
54  bool check_and_update_policy(iter it, node_t current);
55  void initialize();
56  void clear();
57  friend class ShortestPaths<graph_t, MinColorsLength<graph_t>>;
58  };
59 }
60 #include "impl/Graph_Policies.ipp"
Contains the classes mackey::Neighborhood, mackey::Graph, mackey::ShortestPaths.
A directed graph.
Definition: Graph.hpp:49
Dijkstra policy that minimizes the color alterations and length.
Definition: Graph_Policies.hpp:45
MinColorsLength(const graph_t &G)
Computes shortest path in given graph.
ShortestPaths policy that minimizes the length of each path.
Definition: Graph_Policies.hpp:29
MinLength(const graph_t &G)
Computes shortest path in given graph.
The shortest paths from a collection of sources to all points in a graph.
Definition: Graph.hpp:93
std::vector< size_t > distance_policy
The distance from a source to a node, computed by some policy (eg weight)
Definition: Graph.hpp:124
const graph_t & G
Constant reference to the graph.
Definition: Graph.hpp:121
Everything in this library is under this namespace.
Definition: Box.hpp:9
std::ostream & operator<<(std::ostream &, const Chains< rank_t, diff_t > &)
Prints chain complex.
An edge with two possible colors and a numerical id.
Definition: Graph_Policies.hpp:10
unsigned char id
Definition: Graph_Policies.hpp:12
bicolored_edge_with_id(char color, unsigned char id)
char color
Definition: Graph_Policies.hpp:11