9 #include "generated_config.hpp"
14 typedef unsigned int vertex;
15 static const vertex no_vertex = std::numeric_limits<vertex>::max();
17 typedef struct {
int lag;
double drain_factor;
unsigned int max_recharge; } edge;
18 typedef struct { vertex s; vertex t;
int lag;
double drain_factor;
unsigned int max_recharge; } full_edge;
23 typedef full_edge value_type;
24 typedef full_edge *pointer;
25 typedef const full_edge *const_pointer;
26 typedef full_edge &reference;
27 typedef const full_edge &const_reference;
28 typedef size_t size_type;
33 typedef std::input_iterator_tag iterator_category;
34 typedef base value_type;
35 typedef base *pointer;
36 typedef base &reference;
37 typedef size_t size_type;
40 iterator(
const EdgeContainer *c,
bool end =
false);
42 value_type &operator*();
43 value_type *operator->();
45 iterator<base> operator++(
int);
46 iterator<base> operator++();
48 bool operator==(
const iterator<base> &other)
const;
49 bool operator!=(
const iterator<base> &other)
const;
52 const EdgeContainer *c;
53 std::vector< std::map< vertex, edge >>::const_iterator outer;
54 std::map<vertex, edge>::const_iterator inner_iterator;
59 EdgeContainer(
const LagGraph *g,
bool reverse =
false);
60 EdgeContainer(
const LagGraph *g,
unsigned int vertex,
bool reverse =
false);
61 EdgeContainer(
const LagGraph *g,
62 std::vector< std::map< vertex, edge >>::const_iterator start,
63 std::vector< std::map< vertex, edge >>::const_iterator end,
64 std::vector< std::map< vertex, edge >>::const_iterator index_start);
67 iterator<full_edge> begin()
const;
68 iterator<full_edge> end()
const;
69 iterator<const full_edge> cbegin()
const;
70 iterator<const full_edge> cend()
const;
75 std::vector< std::map< vertex, edge >>::const_iterator base_start;
76 std::vector< std::map< vertex, edge >>::const_iterator base_end;
77 std::vector< std::map< vertex, edge >>::const_iterator index_start;
82 void set_limitations(
unsigned long limitations);
85 void add_edge(
const Job & s,
const Job & t, edge lag);
86 void delete_edge(
const Job &s,
const Job &t);
88 edge *get_edge(
const Job & s,
const Job & t);
89 const edge *get_edge(
const Job & s,
const Job & t)
const;
90 edge *get_edge(vertex s, vertex t);
91 const edge *get_edge(vertex s, vertex t)
const;
93 EdgeContainer edges();
94 const EdgeContainer edges()
const;
95 EdgeContainer reverse_edges();
96 const EdgeContainer reverse_edges()
const;
99 const EdgeContainer neighbors(vertex v)
const;
100 const EdgeContainer reverse_neighbors(vertex v)
const;
102 size_t neighbor_count(vertex v)
const;
103 size_t reverse_neighbor_count(vertex v)
const;
104 size_t edge_count()
const;
105 size_t vertex_count()
const;
113 #ifdef ENABLE_CONSISTENCY_CHECKS
114 void check_consistency();
116 inline void check_consistency() {};
120 LagGraph clone()
const;
123 void add_edge(vertex s, vertex t, edge e);
127 std::vector< std::map< vertex, edge >> adj;
128 std::vector< std::map< vertex, edge >> reverse_adj;
130 void check_edge_iterator_consistency();