1 #ifndef DATA_FORMATS_MATH_GRAPH_H 2 #define DATA_FORMATS_MATH_GRAPH_H 12 template <
class N,
class E>
18 using edge_type = std::pair<index_type, index_type>;
35 value_type( const Graph & g, index_type a, index_type e )
173 bool replace(
const N & oldNode ,
const N & newNode );
176 bool replaceEdge(
const E & ldEdge,
const E &newEdge );
228 template<
class N,
class E>
232 std::pair<indexer_iterator,bool>
result 235 if ( result.second ) {
236 nodes_.emplace_back(node);
240 idx = result.first->second;
246 template<
class N,
class E>
249 typename indexer_type::const_iterator
result =
indexer_.find(node);
254 idx = result->second;
260 template<
class N,
class E>
267 edges_.emplace_back(edge);
271 template<
class N,
class E>
275 return edge_range(edges.begin(), edges.end());
279 template<
class N,
class E>
287 template<
class N,
class E>
292 if (idxResult.second) {
299 template<
class N,
class E>
304 if (idxResult.second) {
311 template<
class N,
class E>
314 return nodes_[edge.first];
318 template<
class N,
class E>
325 template<
class N,
class E>
331 template<
class N,
class E>
338 std::vector<bool> rootCandidate(
size(),
true);
340 for (; it != ed; ++it) {
342 for (
auto const & el_it : el) {
343 rootCandidate[el_it.first]=
false;
348 for (; v_sz < v_ed; ++v_sz) {
349 if (rootCandidate[v_sz]) {
355 template<
class N,
class E>
358 typename indexer_type::iterator it =
indexer_.find(oldNode);
369 template<
class N,
class E>
375 for (; it < ed; ++it) {
376 if (
edges_[it] == oldEdge ) {
385 template<
class N,
class E>
394 template<
class N,
class E>
400 for (; it < ed; ++it) {
405 for (; eit < eed; ++eit) {
412 template<
class N,
class E>
421 template<
typename T> std::ostream & operator<<(std::ostream & o, const std::vector< std::vector<std::pair<T,T> > >
v)
423 typedef typename std::vector<std::vector<std::pair<T,T> > > v_t;
424 typedef typename std::vector<std::pair<T,T> > i_t;
426 typename v_t::const_iterator it(
v.begin()), ed(
v.end());
427 for (; it != ed; ++it) {
428 typename i_t::const_iterator iit(it->begin()), ied(it->end());
429 for(; iit != ied; ++iit) {
430 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)