Hi  Péter,<br>
<br>
Thank for your prompt response. I tried to follow the "MapIt route" 
without success, the compilation gives:<br>
 <br>
scheduler.cc: In member function ‘void 
DAGScheduler::put(lemon::ListDigraphBase::Node)’:<br>
scheduler.cc:48: error: no matching function for call to 
‘lemon::MapExtender<lemon::DefaultMap<lemon::DigraphExtender<lemon::ListDigraphBase>,
 lemon::ListDigraphBase::Node, lemon::ListDigraphBase::Arc> 
>::MapIt::MapIt(const 
lemon::DigraphExtender<lemon::ListDigraphBase>::NodeMap<lemon::ListDigraphBase::Arc>&)’<br>
/usr/local/include/lemon/bits/map_extender.h:95: note: candidates are: 
lemon::MapExtender<_Map>::MapIt::MapIt(const 
lemon::MapExtender<_Map>&, const typename _Map::Key&) 
[with _Map = 
lemon::DefaultMap<lemon::DigraphExtender<lemon::ListDigraphBase>,
 lemon::ListDigraphBase::Node, lemon::ListDigraphBase::Arc>]<br>
/usr/local/include/lemon/bits/map_extender.h:91: note:                 
lemon::MapExtender<_Map>::MapIt::MapIt(lemon::MapExtender<_Map>&)
 [with _Map = 
lemon::DefaultMap<lemon::DigraphExtender<lemon::ListDigraphBase>,
 lemon::ListDigraphBase::Node, lemon::ListDigraphBase::Arc>]<br>
/usr/local/include/lemon/bits/map_extender.h:89: note:                 
lemon::MapExtender<_Map>::MapIt::MapIt(lemon::Invalid) [with _Map =
 
lemon::DefaultMap<lemon::DigraphExtender<lemon::ListDigraphBase>,
 lemon::ListDigraphBase::Node, lemon::ListDigraphBase::Arc>]<br>
/usr/local/include/lemon/bits/map_extender.h:87: note:                 
lemon::MapExtender<_Map>::MapIt::MapIt() [with _Map = 
lemon::DefaultMap<lemon::DigraphExtender<lemon::ListDigraphBase>,
 lemon::ListDigraphBase::Node, lemon::ListDigraphBase::Arc>]<br>
/usr/local/include/lemon/bits/map_extender.h:80: note:                 
lemon::MapExtender<lemon::DefaultMap<lemon::DigraphExtender<lemon::ListDigraphBase>,
 lemon::ListDigraphBase::Node, lemon::ListDigraphBase::Arc> 
>::MapIt::MapIt(const 
lemon::MapExtender<lemon::DefaultMap<lemon::DigraphExtender<lemon::ListDigraphBase>,
 lemon::ListDigraphBase::Node, lemon::ListDigraphBase::Arc> 
>::MapIt&)<br>
make: *** [dgraph] Error 1<br>
<br>
The line is:<br>
---------- o ----------<br>
const Bfs<ListDigraph>::PredMap& predMap = bfs.predMap();<br>
typedef ListDigraph::NodeMap<ListDigraph::Arc> PM;<br>
<br>
for(PM::MapIt it(predMap); it != INVALID; ++it) {}<br>
---------- o ----------<br>
<br>
Thank you,<br>
Diego<br><br><div class="gmail_quote">2010/6/24 Kovács Péter <span dir="ltr"><<a href="mailto:kpeter@inf.elte.hu">kpeter@inf.elte.hu</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">Hi,<br>
<br>
If you would like to iterate over all nodes, then you can simply use NodeIt:<br>
<br>
  for (GraphType::NodeIt u(g); u != INVALID; ++u)<br>
    cout << <a href="http://g.id" target="_blank">g.id</a>(u) << " pred arc: " << <a href="http://g.id" target="_blank">g.id</a>(bfs.predArc(u)) << "\n";<br>
<br>
  for (GraphType::NodeIt u(g); u != INVALID; ++u)<br>
    cout << <a href="http://g.id" target="_blank">g.id</a>(u) << " pred node: " << <a href="http://g.id" target="_blank">g.id</a>(bfs.predNode(u)) << "\n";<br>
<br>
If your PredMap is a standard NodeMap<Arc>, then you can also use its MapIt or ConstMapIt iterator type (though it is not documented yet as far as I know):<br>
<br>
  typedef GraphType::NodeMap<GraphType::Arc> PredMap;<br>
  PredMap pred = bfs.predMap();<br>
  for (PredMap::MapIt it(pred); it != INVALID; ++it)<br>
    cout << <a href="http://g.id" target="_blank">g.id</a>(it) << " pred arc: " << <a href="http://g.id" target="_blank">g.id</a>(*it) << "\n";<br>
<br>
On the other hand, if you would like to iterate over the visited nodes only (for efficiency reasons), then you could either<br>
  1. run the algorithm step-by-step and do the required operations meantime (consider to use init(), addSource(), emptyQueue(), nextNode(), processNextNode() functions) or<br>
  2. run the algorithm at once using run(), but use a special ProcessedMap to keep track the visited nodes (consider to use e.g. LoggerBoolMap for this purpose):<br>
<a href="http://lemon.cs.elte.hu/pub/doc/1.2/a00515.html#g21ca379ec2c92eccd71b76df0a9eee8c" target="_blank">http://lemon.cs.elte.hu/pub/doc/1.2/a00515.html#g21ca379ec2c92eccd71b76df0a9eee8c</a><br>
Once you stored the nodes in a container, you can easily iterate over them and you can obtain pred values using predNode(), predArc() or predMap().<br>
<br></div>
I hope that I could answer your questions.<br>
<br>
Best regards,<br>
Peter<div><div></div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
I can't get the map iterator from predMap to work after a bfs (don't<br>
know the syntaxis for that). How can I iterate over all results<br>
including nodes (keys) and values? I couldn't find an example either. A<br>
small code snippet will be more than helpful.<br>
<br>
<br>
Thank You,<br>
Diego<br>
</blockquote>
<br>
</div></div></blockquote></div><br>