|
|
Go to the documentation of this file. 1 #ifndef DATA_FORMATS_MATH_GRAPH_H
2 #define DATA_FORMATS_MATH_GRAPH_H
12 template <
class N,
class E>
17 using edge_type = std::pair<index_type, index_type>;
48 return ((
vt_.a_ ==
i.vt_.a_) && (
vt_.e_ ==
i.vt_.e_)) ?
true :
false;
52 return ((
vt_.a_ ==
i.vt_.a_) && (
vt_.e_ ==
i.vt_.e_)) ?
false :
true;
56 while (
vt_.gr_.size() >
vt_.a_) {
64 while (
vt_.gr_.size() >
vt_.a_) {
65 if (!
vt_.gr_.adjl_[
vt_.a_].empty()) {
129 void addEdge(
const N &from,
const N &
to,
const E &edge);
153 bool replace(
const N &oldNode,
const N &newNode);
156 bool replaceEdge(
const E &ldEdge,
const E &newEdge);
165 const_iterator
begin_iter()
const {
return const_iterator(*
this); }
167 const_iterator
end_iter()
const {
return const_iterator(*
this,
adjl_.size(), 0); }
204 template <
class N,
class E>
210 nodes_.emplace_back(node);
218 template <
class N,
class E>
220 typename indexer_type::const_iterator
result = indexer_.find(node);
223 if (
result != indexer_.end()) {
230 template <
class N,
class E>
235 adjl_[iFrom].emplace_back(
edge_type(iTo, edges_.size()));
236 edges_.emplace_back(edge);
239 template <
class N,
class E>
245 template <
class N,
class E>
251 template <
class N,
class E>
255 if (idxResult.second) {
261 template <
class N,
class E>
265 if (idxResult.second) {
271 template <
class N,
class E>
273 return nodes_[edge.first];
276 template <
class N,
class E>
281 template <
class N,
class E>
283 return nodes_[it - adjl_.begin()];
286 template <
class N,
class E>
292 std::vector<bool> rootCandidate(
size(),
true);
294 for (; it != ed; ++it) {
296 for (
auto const &el_it : el) {
297 rootCandidate[el_it.first] =
false;
302 for (; v_sz < v_ed; ++v_sz) {
303 if (rootCandidate[v_sz]) {
309 template <
class N,
class E>
311 typename indexer_type::iterator it = indexer_.find(oldNode);
312 if (it != indexer_.end()) {
314 nodes_[oldIndex] = newNode;
315 indexer_[newNode] = oldIndex;
322 template <
class N,
class E>
327 for (; it < ed; ++it) {
328 if (edges_[it] == oldEdge) {
330 edges_[it] = newEdge;
337 template <
class N,
class E>
345 template <
class N,
class E>
350 for (; it < ed; ++it) {
355 for (; eit < eed; ++eit) {
357 g.addEdge(nodeData(
e.first), nodeData(it), edgeData(
e.second));
362 template <
class N,
class E>
365 nodes_.swap(
g.nodes_);
366 edges_.swap(
g.edges_);
367 indexer_.swap(
g.indexer_);
368 emptyEdges_.swap(
g.emptyEdges_);
371 template <
typename T>
373 typedef typename std::vector<std::vector<std::pair<T, T> > > v_t;
374 typedef typename std::vector<std::pair<T, T> > i_t;
376 typename v_t::const_iterator it(
v.begin()), ed(
v.end());
377 for (; it != ed; ++it) {
378 typename i_t::const_iterator iit(it->begin()), ied(it->end());
379 for (; iit != ied; ++iit) {
380 o << iit->first <<
':' << iit->second << std::endl;
std::ostream & operator<<(std::ostream &o, const std::vector< std::vector< std::pair< T, T > > > v)
bool operator==(const const_iterator &i) const
adj_list::iterator adj_iterator
std::map< Node2, index_type > indexer_type
std::pair< index_type, bool > index_result
index_type addNode(const N &)
std::pair< index_type, index_type > edge_type
Graph::index_type index_type
bool operator>(const const_iterator &i) const
typename indexer_type::const_iterator const_indexer_iterator
const value_type & operator*() const
bool operator!=(const const_iterator &i) const
edge_list::const_iterator const_edge_iterator
Graph::edge_list edge_list
void findRoots(edge_list &) const
const N & from(void) const
std::vector< edge_type > edge_list
index_result nodeIndex(const N &) const
bool replaceEdge(const E &ldEdge, const E &newEdge)
const value_type * operator->() const
const_iterator begin_iter() const
auto size() const -> adj_list::size_type
const E & edgeData(index_type i) const
std::vector< Node2 > node_list
void addEdge(const N &from, const N &to, const E &edge)
const_iterator end_iter() const
const_iterator(const Graph &g, index_type ait, index_type eit)
Container::value_type value_type
const_adj_iterator end() const
const E & edge(void) const
bool operator<(const const_iterator &i) const
void clear()
it clear everything!
value_type(const N &n, const E &e)
void invert(Graph &g) const
std::pair< const_edge_iterator, const_edge_iterator > const_edge_range
typename indexer_type::iterator indexer_iterator
std::vector< double >::size_type index_type
const_adj_iterator begin() const
void swap(Graph< N, E > &)
const_iterator(const Graph &g)
edge_list::iterator edge_iterator
bool replace(const N &oldNode, const N &newNode)
edge_range edges(index_type nodeIndex)
const N & nodeData(const edge_type &) const
std::vector< edge_list > adj_list
std::pair< edge_iterator, edge_iterator > edge_range
std::vector< AnotherDummy2 > edge_store
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
adj_list::const_iterator const_adj_iterator