11 template <
class N,
class E>
17 typedef std::pair<index_type, index_type>
edge_type;
34 value_type( const graph & g, index_type a, index_type e )
178 bool replace(
const N & oldNode ,
const N & newNode );
181 bool replaceEdge(
const E & ldEdge,
const E &newEdge );
190 const_iterator
begin_iter()
const {
return const_iterator(*
this); }
192 const_iterator
end_iter()
const {
return const_iterator(*
this,
adjl_.size(),0); }
233 template<
class N,
class E>
237 std::pair<indexer_iterator,bool>
result
240 if ( result.second ) {
241 nodes_.push_back(node);
245 idx = result.first->second;
251 template<
class N,
class E>
254 typename indexer_type::const_iterator
result = indexer_.find(node);
257 if (result != indexer_.end()) {
259 idx = result->second;
265 template<
class N,
class E>
271 adjl_[iFrom].push_back(
edge_type(iTo,edges_.size()));
272 edges_.push_back(edge);
276 template<
class N,
class E>
280 return edge_range(edges.begin(), edges.end());
284 template<
class N,
class E>
292 template<
class N,
class E>
297 if (idxResult.second) {
304 template<
class N,
class E>
309 if (idxResult.second) {
316 template<
class N,
class E>
319 return nodes_[edge.first];
323 template<
class N,
class E>
330 template<
class N,
class E>
333 return nodes_[it-adjl_.begin()];
336 template<
class N,
class E>
343 std::vector<bool> rootCandidate(
size(),
true);
345 for (; it != ed; ++it) {
347 typename edge_list::const_iterator el_it = el.begin();
348 typename edge_list::const_iterator el_ed = el.end();
349 for (; el_it != el_ed; ++el_it) {
350 rootCandidate[el_it->first]=
false;
358 for (; v_sz < v_ed; ++v_sz) {
359 if (rootCandidate[v_sz]) {
366 template<
class N,
class E>
369 typename indexer_type::iterator it = indexer_.find(oldNode);
370 if (it != indexer_.end()) {
372 nodes_[oldIndex]=newNode;
373 indexer_[newNode]=oldIndex;
380 template<
class N,
class E>
387 for (; it < ed; ++it) {
389 if ( edges_[it] == oldEdge ) {
392 edges_[it] = newEdge;
400 template<
class N,
class E>
409 template<
class N,
class E>
423 template<
class N,
class E>
429 for (; it < ed; ++it) {
434 for (; eit < eed; ++eit) {
436 g.
addEdge(nodeData(e.first), nodeData(it), edgeData(e.second));
441 template<
class N,
class E>
450 template<
typename T> std::ostream & operator<<(std::ostream & o, const std::vector< std::vector<std::pair<T,T> > >
v)
452 typedef typename std::vector<std::vector<std::pair<T,T> > > v_t;
453 typedef typename std::vector<std::pair<T,T> > i_t;
455 typename v_t::const_iterator it(
v.begin()), ed(
v.end());
456 for (; it != ed; ++it) {
457 typename i_t::const_iterator iit(it->begin()), ied(it->end());
458 for(; iit != ied; ++iit) {
459 o << iit->first <<
':' << iit->second << std::endl;
const_iterator(const graph &g)
adj_list::size_type size() const
bool operator!=(const const_iterator &i) const
std::vector< N > node_list
std::pair< index_type, bool > index_result
std::pair< edge_iterator, edge_iterator > edge_range
std::pair< const_edge_iterator, const_edge_iterator > const_edge_range
indexer_type::iterator indexer_iterator
bool replaceEdge(const E &ldEdge, const E &newEdge)
adj_list::iterator adj_iterator
void clear()
it clear everything!
const N & nodeData(const edge_type &) const
const E & edgeData(index_type i) const
const_adj_iterator begin() const
const N & from(void) const
const_adj_iterator end() const
indexer_type::const_iterator const_indexer_iterator
std::vector< double >::size_type index_type
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
std::pair< index_type, index_type > edge_type
std::vector< E > edge_store
std::vector< edge_type > edge_list
edge_range edges(index_type nodeIndex)
value_type(const N &n, const E &e)
void dump_graph(void) const
graph::edge_list edge_list
graph::index_type index_type
const_iterator begin_iter() const
Container::value_type value_type
std::vector< edge_list > adj_list
static std::string from(" from ")
bool operator<(const const_iterator &i) const
edge_list::iterator edge_iterator
const E & edge(void) const
const_iterator(const graph &g, index_type ait, index_type eit)
bool replace(const N &oldNode, const N &newNode)
index_type addNode(const N &)
adj_list::const_iterator const_adj_iterator
edge_list::const_iterator const_edge_iterator
bool operator==(const const_iterator &i) const
bool operator>(const const_iterator &i) const
void findRoots(edge_list &) const
void invert(graph &g) const
const value_type * operator->() const
void addEdge(const N &from, const N &to, const E &edge)
const value_type & operator*() const
index_result nodeIndex(const N &) const
tuple size
Write out results.
const_iterator end_iter() const
void swap(graph< N, E > &)
std::map< N, index_type > indexer_type