32 insert (_from_to, from, to);
33 insert (_to_from, to, from);
35 EdgeMapWithSends::iterator i = find_in_from_to_with_sends (from, to);
36 if (i != _from_to_with_sends.end ()) {
37 i->second.second = via_sends_only;
39 _from_to_with_sends.insert (
40 make_pair (from, make_pair (to, via_sends_only))
48 GraphEdges::EdgeMapWithSends::iterator
51 typedef EdgeMapWithSends::iterator Iter;
52 pair<Iter, Iter> r = _from_to_with_sends.equal_range (from);
53 for (Iter i = r.first; i != r.second; ++i) {
54 if (i->second.first == to) {
59 return _from_to_with_sends.end ();
69 EdgeMapWithSends::iterator i = find_in_from_to_with_sends (from, to);
70 if (i == _from_to_with_sends.end ()) {
75 *via_sends_only = i->second.second;
85 EdgeMap::const_iterator i = _from_to.find (r);
86 if (i == _from_to.end ()) {
87 return set<GraphVertex> ();
96 EdgeMap::iterator i = _from_to.find (from);
97 assert (i != _from_to.end ());
99 if (i->second.empty ()) {
103 EdgeMap::iterator j = _to_from.find (to);
104 assert (j != _to_from.end ());
105 j->second.erase (from);
106 if (j->second.empty ()) {
110 EdgeMapWithSends::iterator k = find_in_from_to_with_sends (from, to);
111 assert (k != _from_to_with_sends.end ());
112 _from_to_with_sends.erase (k);
122 return _to_from.find (to) == _to_from.end ();
126 GraphEdges::empty ()
const
128 assert (_from_to.empty () == _to_from.empty ());
129 return _from_to.empty ();
133 GraphEdges::dump ()
const
135 for (EdgeMap::const_iterator i = _from_to.begin(); i != _from_to.end(); ++i) {
136 cout <<
"FROM: " << i->first->name() <<
" ";
137 for (set<GraphVertex>::const_iterator j = i->second.begin(); j != i->second.end(); ++j) {
138 cout << (*j)->name() <<
" ";
143 for (EdgeMap::const_iterator i = _to_from.begin(); i != _to_from.end(); ++i) {
144 cout <<
"TO: " << i->first->name() <<
" ";
145 for (set<GraphVertex>::const_iterator j = i->second.begin(); j != i->second.end(); ++j) {
146 cout << (*j)->name() <<
" ";
156 EdgeMap::iterator i = e.find (a);
158 i->second.insert (b);
162 e.insert (make_pair (a, v));
205 for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
207 queue.push_back (*i);
221 while (!queue.empty ()) {
224 sorted_routes->push_back (r);
225 set<GraphVertex> e = edges.
from (r);
226 for (set<GraphVertex>::iterator i = e.begin(); i != e.end(); ++i) {
229 queue.push_back (*i);
234 if (!edges.
empty ()) {
240 return sorted_routes;
void remove(GraphVertex from, GraphVertex to)
virtual bool record_enabled() const
std::map< GraphVertex, std::set< GraphVertex > > EdgeMap
uint32_t order_key() const
boost::shared_ptr< RouteList > topological_sort(boost::shared_ptr< RouteList >, GraphEdges)
std::set< GraphVertex > from(GraphVertex r) const
bool has_none_to(GraphVertex to) const
std::list< boost::shared_ptr< Route > > RouteList