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>;
153 bool replace(
const N &oldNode,
const N &newNode);
156 bool replaceEdge(
const E &ldEdge,
const E &newEdge);
204 template <
class N,
class E>
210 nodes_.emplace_back(node);
213 idx = result.first->second;
218 template <
class N,
class E>
220 typename indexer_type::const_iterator
result =
indexer_.find(node);
225 idx = result->second;
230 template <
class N,
class E>
236 edges_.emplace_back(edge);
239 template <
class N,
class E>
242 return edge_range(edges.begin(), edges.end());
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>
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);
314 nodes_[oldIndex] = newNode;
322 template <
class N,
class E>
327 for (; it < ed; ++it) {
328 if (
edges_[it] == oldEdge) {
337 template <
class N,
class E>
345 template <
class N,
class E>
350 for (; it < ed; ++it) {
355 for (; eit < eed; ++eit) {
362 template <
class N,
class E>
371 template <
typename T>
372 std::ostream &operator<<(std::ostream &o, const std::vector<std::vector<std::pair<T, T> > >
v) {
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;
bool operator!=(const const_iterator &i) const
const_adj_iterator begin() const
const_iterator(const Graph &g)
std::vector< double >::size_type index_type
bool operator<(const const_iterator &i) const
edge_range edges(index_type nodeIndex)
void addEdge(const N &from, const N &to, const E &edge)
std::pair< const_edge_iterator, const_edge_iterator > const_edge_range
index_type addNode(const N &)
std::pair< index_type, bool > index_result
const_iterator end_iter() const
void invert(Graph &g) const
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
U second(std::pair< T, U > const &p)
bool replace(const N &oldNode, const N &newNode)
edge_list::iterator edge_iterator
std::pair< edge_iterator, edge_iterator > edge_range
Container::value_type value_type
const_iterator begin_iter() const
adj_list::iterator adj_iterator
const N & nodeData(const edge_type &) const
const E & edgeData(index_type i) const
const_adj_iterator end() const
void findRoots(edge_list &) const
index_result nodeIndex(const N &) const
const value_type & operator*() const
void swap(Graph< N, E > &)
void clear()
it clear everything!
std::map< Node2, index_type > indexer_type
std::vector< Node2 > node_list
const value_type * operator->() const
std::pair< index_type, index_type > edge_type
Graph::index_type index_type
std::vector< edge_list > adj_list
std::vector< edge_type > edge_list
const_iterator(const Graph &g, index_type ait, index_type eit)
auto size() const -> adj_list::size_type
typename indexer_type::iterator indexer_iterator
const E & edge(void) const
value_type(const N &n, const E &e)
edge_list::const_iterator const_edge_iterator
Graph::edge_list edge_list
bool operator>(const const_iterator &i) const
adj_list::const_iterator const_adj_iterator
const N & from(void) const
bool operator==(const const_iterator &i) const
typename indexer_type::const_iterator const_indexer_iterator
bool replaceEdge(const E &ldEdge, const E &newEdge)