https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix the graph pretty-printer.
* mln/util/internal/graph_base.hh
(mln::util::internal::graph_base<V, E>::print_debug): Print the
adjacent vertices, not the adjacent edges.
graph_base.hh | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
Index: mln/util/internal/graph_base.hh
--- mln/util/internal/graph_base.hh (revision 2017)
+++ mln/util/internal/graph_base.hh (working copy)
@@ -626,17 +626,18 @@
graph_base<V, E>::print_debug (std::ostream& ostr) const
{
ostr << "graph: " << std::endl;
- int i = 0;
- for (typename vertices_t::const_iterator v = vertices_.begin ();
- v != vertices_.end (); ++v, ++i)
+ for (unsigned v = 0; v < vertices_.size(); ++v)
{
- ostr << "vertex: " << i << std::endl << " --
adjacent vertices: ";
+ ostr << "vertex: " << v << std::endl << " --
adjacent vertices: ";
/* FIXME: We shouldn't manipulate std::vector<edge_id>
directly, but use a typedef instead. */
for (typename std::vector<util::edge_id>::const_iterator e =
- (*v)->edges.begin();
- e != (*v)->edges.end(); ++e)
- ostr << *e << " ";
+ vertices_[v]->edges.begin(); e != vertices_[v]->edges.end();
+ ++e)
+ if (v == edges_[*e]->v1())
+ ostr << edges_[*e]->v2() << " ";
+ else
+ ostr << edges_[*e]->v1() << " ";
ostr << std::endl;
}
ostr << std::endl;