* mln/make/graph.hh: Fix use of label<n>.
* mln/util/edge.hh: cleanup comment.
* mln/util/dual_graph.hh: rename as...
* mln/util/line_graph.hh: ... this. Fiw wrong initialization.
* tests/util/Makefile.am: update.
* tests/util/dual_graph.cc: rename as...
* tests/util/line_graph.cc: ... this. Enable all the tests.
* mln/core/concept/graph.hh,
* mln/util/internal/graph_base.hh,
* mln/util/graph.hh: rename graph_id to id.
---
milena/ChangeLog | 20 +++
milena/mln/core/concept/graph.hh | 24 ++--
milena/mln/make/graph.hh | 2 +-
milena/mln/util/edge.hh | 2 +-
milena/mln/util/graph.hh | 23 +++-
milena/mln/util/internal/graph_base.hh | 6 +-
milena/mln/util/{dual_graph.hh => line_graph.hh} | 152 ++++++++++++++------
milena/tests/util/Makefile.am | 4 +-
milena/tests/util/{dual_graph.cc => line_graph.cc} | 109 +++++++-------
9 files changed, 224 insertions(+), 118 deletions(-)
rename milena/mln/util/{dual_graph.hh => line_graph.hh} (68%)
rename milena/tests/util/{dual_graph.cc => line_graph.cc} (61%)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 959337a..cf63c58 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,25 @@
2008-11-25 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Fix line_graph (formerly dual_graph)
+
+ * mln/make/graph.hh: Fix use of label<n>.
+
+ * mln/util/edge.hh: cleanup comment.
+
+ * mln/util/dual_graph.hh: rename as...
+ * mln/util/line_graph.hh: ... this. Fiw wrong initialization.
+
+ * tests/util/Makefile.am: update.
+
+ * tests/util/dual_graph.cc: rename as...
+ * tests/util/line_graph.cc: ... this. Enable all the tests.
+
+ * mln/core/concept/graph.hh,
+ * mln/util/internal/graph_base.hh,
+ * mln/util/graph.hh: rename graph_id to id.
+
+2008-11-25 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Fix labeling::compute tests.
* mln/labeling/compute.hh: Check if the image is a labeled image and
diff --git a/milena/mln/core/concept/graph.hh b/milena/mln/core/concept/graph.hh
index 8339531..80c2ae2 100644
--- a/milena/mln/core/concept/graph.hh
+++ b/milena/mln/core/concept/graph.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -28,15 +28,15 @@
#ifndef MLN_CORE_CONCEPT_GRAPH_HH
# define MLN_CORE_CONCEPT_GRAPH_HH
-/*! \file mln/core/concept/graph.hh
- * \brief Definition of the concept of mln::Graph.
- */
+/// \file mln/core/concept/graph.hh
+///
+/// Definition of the concept of mln::Graph.
namespace mln
{
- // Fwd decl.
+ // Forward declaration.
template <typename E> struct Graph;
// Graph category flag type.
@@ -46,11 +46,11 @@ namespace mln
typedef Object<void> super;
};
- /*! \brief Base class for implementation of graph classes.
- *
- * \see mln::doc::Graph for a complete documentation of this class
- * contents.
- */
+ /// Base class for implementation of graph classes.
+ ///
+ /// \see mln::doc::Graph for a complete documentation of this class
+ /// contents.
+ ///
template <typename E>
struct Graph : public Object<E>
{
@@ -67,7 +67,7 @@ namespace mln
typedef bkd_piter;
// Misc.
- const E& graph_id() const;
+ const E& id() const;
template<typename G2>
bool is_subgraph_of(const G2& gr) const;
@@ -109,7 +109,7 @@ namespace mln
//typedef mln_bkd_piter(E) bkd_piter;
// Check methods
- const void* (E::*m1)() const = & E::graph_id;
+ const void* (E::*m1)() const = & E::id;
m1 = 0;
unsigned (E::*m2)(unsigned id_e, unsigned id_v) const = & E::v_other;
m2 = 0;
diff --git a/milena/mln/make/graph.hh b/milena/mln/make/graph.hh
index c3ae618..ac232e8 100644
--- a/milena/mln/make/graph.hh
+++ b/milena/mln/make/graph.hh
@@ -88,7 +88,7 @@ namespace mln
const I& iz = exact(iz_);
util::graph g;
- g.add_vertices(nlabels + 1);
+ g.add_vertices(nlabels.next());
mln_piter(I) p(iz.domain());
for_all(p)
diff --git a/milena/mln/util/edge.hh b/milena/mln/util/edge.hh
index ba34a12..0390be4 100644
--- a/milena/mln/util/edge.hh
+++ b/milena/mln/util/edge.hh
@@ -41,7 +41,7 @@ namespace mln
namespace util
{
- /*-------.
+ /*-------.
| Edge. |
`-------*/
diff --git a/milena/mln/util/graph.hh b/milena/mln/util/graph.hh
index 7c003a2..a3f5df5 100644
--- a/milena/mln/util/graph.hh
+++ b/milena/mln/util/graph.hh
@@ -231,6 +231,9 @@ namespace mln
};
+ std::ostream&
+ operator<<(std::ostream& ostr, const graph& g);
+
} // end of namespace mln::util
} // end of namespace mln
@@ -480,7 +483,25 @@ namespace mln
bool
graph::is_subgraph_of(const G2& g) const
{
- return g.graph_id() == this->graph_id();
+ return g.id() == this->id();
+ }
+
+ // FIXME: move to graph_Base.
+ inline
+ std::ostream&
+ operator<<(std::ostream& ostr, const graph& g)
+ {
+ mln_vertex_iter_(graph) v(g);
+ mln_vertex_nbh_edge_iter_(graph) e(v);
+ for_all(v)
+ {
+ ostr << "v(" << v << ") : ";
+ for_all(e)
+ ostr << e << " ";
+ ostr << std::endl;
+ }
+
+ return ostr;
}
} // end of namespace mln::util
diff --git a/milena/mln/util/internal/graph_base.hh
b/milena/mln/util/internal/graph_base.hh
index f659b54..ac6099e 100644
--- a/milena/mln/util/internal/graph_base.hh
+++ b/milena/mln/util/internal/graph_base.hh
@@ -82,7 +82,7 @@ namespace mln
/// Misc. methods
/// \{
/// Returns the graph id, the "this" pointer.
- const void* graph_id() const;
+ const void* id() const;
/// \}
/// Vertex oriented methods
@@ -158,7 +158,7 @@ namespace mln
template<typename E>
inline
const void*
- graph_base<E>::graph_id() const
+ graph_base<E>::id() const
{
return static_cast<const void*>(data_.ptr_);
}
@@ -248,7 +248,7 @@ namespace mln
operator==(const util::internal::graph_base<E>& lhs,
const util::internal::graph_base<E>& rhs)
{
- return lhs.graph_id() == rhs.graph_id();
+ return lhs.id() == rhs.id();
}
} // end of namespace mln
diff --git a/milena/mln/util/dual_graph.hh b/milena/mln/util/line_graph.hh
similarity index 68%
rename from milena/mln/util/dual_graph.hh
rename to milena/mln/util/line_graph.hh
index 3533e7c..6ae1c5b 100644
--- a/milena/mln/util/dual_graph.hh
+++ b/milena/mln/util/line_graph.hh
@@ -26,10 +26,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_UTIL_DUAL_GRAPH_HH
-# define MLN_UTIL_DUAL_GRAPH_HH
+#ifndef MLN_UTIL_LINE_GRAPH_HH
+# define MLN_UTIL_LINE_GRAPH_HH
-/// \file mln/util/dual_graph.hh
+/// \file mln/util/line_graph.hh
/// Definitions of undirected graphs.
# include <mln/util/internal/graph_base.hh>
@@ -44,7 +44,7 @@ namespace mln
{
/// Fwd declaration.
template <typename G>
- class dual_graph;
+ class line_graph;
}
@@ -53,7 +53,7 @@ namespace mln
/// Data structure for \c mln::image2d<T>.
template <typename G>
- struct data< util::dual_graph<G> >
+ struct data< util::line_graph<G> >
{
typedef std::vector<std::vector<unsigned> > vertices_t;
@@ -76,12 +76,12 @@ namespace mln
namespace util
{
- /// Undirected dual graph of a graph of type \tparam G.
+ /// Undirected line graph of a graph of type \tparam G.
template <typename G>
- class dual_graph : public internal::graph_base< dual_graph<G> >
+ class line_graph : public internal::graph_base< line_graph<G> >
{
/// The super class.
- typedef internal::graph_base< dual_graph<G> > super;
+ typedef internal::graph_base< line_graph<G> > super;
typedef typename super::vertex_t vertex_t;
typedef typename super::edge_t edge_t;
@@ -100,23 +100,52 @@ namespace mln
/// \{
/// Vertex iterators
/// \{
- typedef mln::internal::vertex_fwd_iterator< dual_graph<G> >
+ typedef mln::internal::vertex_fwd_iterator< line_graph<G> >
vertex_fwd_iter;
- typedef mln::internal::vertex_bkd_iterator< dual_graph<G> >
+ typedef mln::internal::vertex_bkd_iterator< line_graph<G> >
vertex_bkd_iter;
typedef vertex_fwd_iter vertex_iter;
+ /// \}
- typedef mln::internal::edge_fwd_iterator< dual_graph<G> >
+ /// Edge iterators
+ /// \{
+ typedef mln::internal::edge_fwd_iterator< line_graph<G> >
edge_fwd_iter;
- typedef mln::internal::edge_bkd_iterator< dual_graph<G> >
+ typedef mln::internal::edge_bkd_iterator< line_graph<G> >
edge_bkd_iter;
typedef edge_fwd_iter edge_iter;
+ /// \}
+
+ /// Edge nbh edge iterators
+ /// \{
+ typedef mln::internal::edge_nbh_edge_fwd_iterator< line_graph<G> >
+ edge_nbh_edge_fwd_iter;
+ typedef mln::internal::edge_nbh_edge_bkd_iterator< line_graph<G> >
+ edge_nbh_edge_bkd_iter;
+ typedef edge_nbh_edge_fwd_iter edge_nbh_edge_iter;
+ /// \}
+
+ /// Vertex nbh vertex iterators
+ /// \{
+ typedef mln::internal::vertex_nbh_vertex_fwd_iterator< line_graph<G> >
+ vertex_nbh_vertex_fwd_iter;
+ typedef mln::internal::vertex_nbh_vertex_bkd_iterator< line_graph<G> >
+ vertex_nbh_vertex_bkd_iter;
+ typedef vertex_nbh_vertex_fwd_iter vertex_nbh_vertex_iter;
+ /// \}
+ /// Vertex nbh edge iterators
+ /// \{
+ typedef mln::internal::vertex_nbh_edge_fwd_iterator< line_graph<G> >
+ vertex_nbh_edge_fwd_iter;
+ typedef mln::internal::vertex_nbh_edge_bkd_iterator< line_graph<G> >
+ vertex_nbh_edge_bkd_iter;
+ typedef vertex_nbh_edge_fwd_iter vertex_nbh_edge_iter;
/// \}
/// \}
- dual_graph();
- dual_graph(const G& g);
+ line_graph();
+ line_graph(const G& g);
/// Vertex oriented.
/// \{
@@ -190,6 +219,10 @@ namespace mln
using super::data_;
};
+ template <typename G>
+ std::ostream&
+ operator<<(std::ostream& ostr, const line_graph<G>& g);
+
} // end of namespace mln::util
} // end of namespace mln
@@ -204,15 +237,18 @@ namespace mln
template <typename G>
inline
- data< util::dual_graph<G> >::data()
+ data< util::line_graph<G> >::data()
{
}
template <typename G>
inline
- data< util::dual_graph<G> >::data(const G& g)
+ data< util::line_graph<G> >::data(const G& g)
{
g_ = g;
+
+ // Initialize vertices and edges.
+ std::set<util::ord_pair<unsigned> > edges_set;
vertices_.resize(g.e_nmax());
mln_edge_iter(G) e(g);
mln_edge_nbh_edge_iter(G) ne(e);
@@ -220,14 +256,20 @@ namespace mln
for_all(e)
for_all(ne)
{
- vertices_[e].push_back(edges_.size());
- edges_.push_back(util::ord_pair<unsigned>(e, ne));
+ util::ord_pair<unsigned> edge(e, ne);
+ if (edges_set.find(edge) == edges_set.end())
+ {
+ vertices_[e].push_back(edges_.size());
+ vertices_[ne].push_back(edges_.size());
+ edges_set.insert(edge);
+ edges_.push_back(edge);
+ }
}
}
template <typename G>
inline
- data< util::dual_graph<G> >::~data()
+ data< util::line_graph<G> >::~data()
{
}
@@ -238,16 +280,16 @@ namespace mln
template <typename G>
inline
- dual_graph<G>::dual_graph()
+ line_graph<G>::line_graph()
{
- this->data_ = new mln::internal::data< util::dual_graph<G> >();
+ this->data_ = new mln::internal::data< util::line_graph<G> >();
}
template <typename G>
inline
- dual_graph<G>::dual_graph(const G& g)
+ line_graph<G>::line_graph(const G& g)
{
- this->data_ = new mln::internal::data< util::dual_graph<G> >(g);
+ this->data_ = new mln::internal::data< util::line_graph<G> >(g);
}
/*---------------.
@@ -256,8 +298,8 @@ namespace mln
template <typename G>
inline
- typename dual_graph<G>::vertex_t
- dual_graph<G>::vertex(unsigned id_v) const
+ typename line_graph<G>::vertex_t
+ line_graph<G>::vertex(unsigned id_v) const
{
mln_assertion(has_v(id_v));
return vertex_t(*this, id_v);
@@ -267,7 +309,7 @@ namespace mln
template <typename G>
inline
size_t
- dual_graph<G>::v_nmax() const
+ line_graph<G>::v_nmax() const
{
return data_->g_.e_nmax();
}
@@ -275,7 +317,7 @@ namespace mln
template <typename G>
inline
bool
- dual_graph<G>::has_v(unsigned id_v) const
+ line_graph<G>::has_v(unsigned id_v) const
{
return data_->g_.has_e(id_v);
}
@@ -284,7 +326,7 @@ namespace mln
template <typename G2>
inline
bool
- dual_graph<G>::has_v(const util::vertex<G2>& v) const
+ line_graph<G>::has_v(const util::vertex<G2>& v) const
{
//FIXME: not sure...
return v.graph().is_subgraph_of(*this) && has_v(v.id());
@@ -293,16 +335,16 @@ namespace mln
template <typename G>
inline
size_t
- dual_graph<G>::v_nmax_nbh_edges(unsigned id_v) const
+ line_graph<G>::v_nmax_nbh_edges(unsigned id_v) const
{
mln_precondition(has_v(id_v));
- return data_->g_.e_nmax_nbh_edges(id_v);
+ return data_->vertices_[id_v].size();
}
template <typename G>
inline
unsigned
- dual_graph<G>::v_ith_nbh_edge(unsigned id_v, unsigned i) const
+ line_graph<G>::v_ith_nbh_edge(unsigned id_v, unsigned i) const
{
mln_precondition(has_v(id_v));
if (i >= v_nmax_nbh_edges(id_v))
@@ -313,7 +355,7 @@ namespace mln
template <typename G>
inline
size_t
- dual_graph<G>::v_nmax_nbh_vertices(unsigned id_v) const
+ line_graph<G>::v_nmax_nbh_vertices(unsigned id_v) const
{
mln_precondition(has_v(id_v));
return v_nmax_nbh_edges(id_v);
@@ -322,7 +364,7 @@ namespace mln
template <typename G>
inline
unsigned
- dual_graph<G>::v_ith_nbh_vertex(unsigned id_v, unsigned i) const
+ line_graph<G>::v_ith_nbh_vertex(unsigned id_v, unsigned i) const
{
mln_precondition(has_v(id_v));
@@ -337,8 +379,8 @@ namespace mln
template <typename G>
inline
- typename dual_graph<G>::edge_t
- dual_graph<G>::edge(unsigned e) const
+ typename line_graph<G>::edge_t
+ line_graph<G>::edge(unsigned e) const
{
mln_assertion(e < e_nmax());
return edge_t(*this, e);
@@ -347,7 +389,7 @@ namespace mln
template <typename G>
inline
size_t
- dual_graph<G>::e_nmax() const
+ line_graph<G>::e_nmax() const
{
return data_->edges_.size();
}
@@ -355,7 +397,7 @@ namespace mln
template <typename G>
inline
bool
- dual_graph<G>::has_e(unsigned id_e) const
+ line_graph<G>::has_e(unsigned id_e) const
{
return id_e < data_->edges_.size();
}
@@ -364,7 +406,7 @@ namespace mln
template <typename G2>
inline
bool
- dual_graph<G>::has_e(const util::edge<G2>& e) const
+ line_graph<G>::has_e(const util::edge<G2>& e) const
{
return e.graph().is_subgraph_of(*this) && has_e(e.id());
}
@@ -372,7 +414,7 @@ namespace mln
template <typename G>
inline
unsigned
- dual_graph<G>::v1(unsigned id_e) const
+ line_graph<G>::v1(unsigned id_e) const
{
mln_precondition(has_e(id_e));
return data_->edges_[id_e].first();
@@ -381,7 +423,7 @@ namespace mln
template <typename G>
inline
unsigned
- dual_graph<G>::v2(unsigned id_e) const
+ line_graph<G>::v2(unsigned id_e) const
{
mln_precondition(has_e(id_e));
return data_->edges_[id_e].second();
@@ -390,7 +432,7 @@ namespace mln
template <typename G>
inline
size_t
- dual_graph<G>::e_nmax_nbh_edges(unsigned id_e) const
+ line_graph<G>::e_nmax_nbh_edges(unsigned id_e) const
{
mln_precondition(has_e(id_e));
return v_nmax_nbh_edges(v1(id_e)) + v_nmax_nbh_edges(v2(id_e));
@@ -399,7 +441,7 @@ namespace mln
template <typename G>
inline
unsigned
- dual_graph<G>::e_ith_nbh_edge(unsigned id_e, unsigned i) const
+ line_graph<G>::e_ith_nbh_edge(unsigned id_e, unsigned i) const
{
mln_precondition(has_e(id_e));
if (i >= e_nmax_nbh_edges(id_e))
@@ -416,9 +458,29 @@ namespace mln
template <typename G2>
inline
bool
- dual_graph<G>::is_subgraph_of(const G2& g) const
+ line_graph<G>::is_subgraph_of(const G2& g) const
+ {
+ return g.id() == this->id();
+ }
+
+ // FIXME: move to graph_base
+ template <typename G>
+ inline
+ std::ostream&
+ operator<<(std::ostream& ostr, const line_graph<G>& g)
{
- return g.graph_id() == this->graph_id();
+ typedef line_graph<G> LG;
+ mln_vertex_iter(LG) v(g);
+ mln_vertex_nbh_edge_iter(LG) e(v);
+ for_all(v)
+ {
+ ostr << "v(" << v << ") : ";
+ for_all(e)
+ ostr << e << " ";
+ ostr << std::endl;
+ }
+
+ return ostr;
}
} // end of namespace mln::util
@@ -428,4 +490,4 @@ namespace mln
# endif // ! MLN_INCLUDE_ONLY
-#endif // ! MLN_UTIL_DUAL_GRAPH_HH
+#endif // ! MLN_UTIL_LINE_GRAPH_HH
diff --git a/milena/tests/util/Makefile.am b/milena/tests/util/Makefile.am
index fcfb902..07abfab 100644
--- a/milena/tests/util/Makefile.am
+++ b/milena/tests/util/Makefile.am
@@ -6,7 +6,7 @@ include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
branch_iter \
branch_iter_ind \
- dual_graph \
+ line_graph \
eat \
graph \
lazy_set \
@@ -20,7 +20,7 @@ check_PROGRAMS = \
branch_iter_SOURCES = branch_iter.cc
branch_iter_ind_SOURCES = branch_iter_ind.cc
-dual_graph_SOURCES = dual_graph.cc
+line_graph_SOURCES = line_graph.cc
eat_SOURCES = eat.cc
graph_SOURCES = graph.cc
lazy_set_SOURCES = lazy_set.cc
diff --git a/milena/tests/util/dual_graph.cc b/milena/tests/util/line_graph.cc
similarity index 61%
rename from milena/tests/util/dual_graph.cc
rename to milena/tests/util/line_graph.cc
index ff8c8ad..655007c 100644
--- a/milena/tests/util/dual_graph.cc
+++ b/milena/tests/util/line_graph.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright(C) 2008 EPITA Research and Development Laboratory(LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
@@ -25,71 +25,71 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// \file tests/util/dual_graph.cc
-/// test of mln::util::dual_graph
+/// \file tests/util/line_graph.cc
+/// test of mln::util::line_graph
#include <mln/util/graph.hh>
-#include <mln/util/dual_graph.hh>
+#include <mln/util/line_graph.hh>
#include <iostream>
-int main ()
+int main()
{
using namespace mln;
util::graph g;
- g.add_vertex (); // 0
- g.add_vertex (); // 1
- g.add_vertex (); // 2
- g.add_vertex (); // 3
- g.add_vertex (); // 4
- g.add_vertex (); // 5
- g.add_edge (0, 1);
- g.add_edge (1, 0); // Not inserted twice
- g.add_edge (0, 2);
- g.add_edge (3, 4);
- g.add_edge (4, 5);
- g.add_edge (5, 4); // Not inserted twice
- g.add_edge (5, 3);
- g.add_edge (2, 1);
+ g.add_vertex(); // 0
+ g.add_vertex(); // 1
+ g.add_vertex(); // 2
+ g.add_vertex(); // 3
+ g.add_vertex(); // 4
+ g.add_vertex(); // 5
+ g.add_edge(0, 1);
+ g.add_edge(1, 0); // Not inserted twice
+ g.add_edge(0, 2);
+ g.add_edge(3, 4);
+ g.add_edge(4, 5);
+ g.add_edge(5, 4); // Not inserted twice
+ g.add_edge(5, 3);
+ g.add_edge(2, 1);
- typedef util::dual_graph<util::graph> DG;
- DG dg(g);
+ typedef util::line_graph<util::graph> LG;
+ LG lg(g);
- // Vertex iter and edge iter
+ // Vertex and edge forward iterators.
{
unsigned i = 0;
- mln_vertex_fwd_iter_(DG) v(dg);
+ mln_vertex_fwd_iter_(LG) v(lg);
for_all(v)
- std::cout << v.index() << std::endl;
-// mln_assertion(i++ == v.index());
- //mln_assertion(i != 0);
+ mln_assertion(i++ == v.index());
+ mln_assertion(i != 0);
i = 0;
- mln_edge_fwd_iter_(util::graph) e(g);
+ mln_edge_fwd_iter_(LG) e(lg);
for_all(e)
- std::cout << e << std::endl;
-// mln_assertion(i++ == e.index());
-// mln_assertion(i != 0);*/
+ mln_assertion(i++ == e.index());
+ mln_assertion(i != 0);
}
-/* {
- unsigned i = g.v_nmax() - 1;
- mln_vertex_bkd_iter_(util::graph) v(g);
+
+ // Vertex and edge backward iterators.
+ {
+ unsigned i = lg.v_nmax() - 1;
+ mln_vertex_bkd_iter_(LG) v(lg);
for_all(v)
mln_assertion(i-- == v.index());
- mln_assertion(i != g.v_nmax() - 1);
+ mln_assertion(i != lg.v_nmax() - 1);
- i = g.e_nmax() - 1;
- mln_edge_bkd_iter_(util::graph) e(g);
+ i = lg.e_nmax() - 1;
+ mln_edge_bkd_iter_(LG) e(lg);
for_all(e)
mln_assertion(i-- == e.index());
- mln_assertion(i != g.e_nmax() - 1);
+ mln_assertion(i != lg.e_nmax() - 1);
}
- // vertex iter + Edge nbh iter
+ // Vertex and edge nbh forward iterators
{
- mln_vertex_fwd_iter_(util::graph) v(g);
- mln_vertex_nbh_edge_fwd_iter_(util::graph) n(v);
+ mln_vertex_fwd_iter_(LG) v(lg);
+ mln_vertex_nbh_edge_fwd_iter_(LG) n(v);
for_all(v)
{
unsigned i = 0;
@@ -98,9 +98,11 @@ int main ()
mln_assertion(i != 0);
}
}
+
+ // Vertex and edge nbh backward iterators.
{
- mln_vertex_bkd_iter_(util::graph) v(g);
- mln_vertex_nbh_edge_bkd_iter_(util::graph) e(v);
+ mln_vertex_bkd_iter_(LG) v(lg);
+ mln_vertex_nbh_edge_bkd_iter_(LG) e(v);
for_all(v)
{
unsigned i = v.nmax_nbh_edges();
@@ -109,10 +111,12 @@ int main ()
mln_assertion((v.nmax_nbh_edges() == 0 && i == 0) || i !=
v.nmax_nbh_edges());
}
}
-
+ std::cout << g << std::endl;
+ std::cout << "----" << std::endl;
+ std::cout << lg << std::endl;
{
- mln_edge_fwd_iter_(util::graph) e(g);
- mln_edge_nbh_edge_fwd_iter_(util::graph) n(e);
+ mln_edge_fwd_iter_(LG) e(lg);
+ mln_edge_nbh_edge_fwd_iter_(LG) n(e);
for_all(e)
{
unsigned i = 0;
@@ -124,8 +128,8 @@ int main ()
}
}
{
- mln_edge_bkd_iter_(util::graph) e(g);
- mln_edge_nbh_edge_bkd_iter_(util::graph) n(e);
+ mln_edge_bkd_iter_(LG) e(lg);
+ mln_edge_nbh_edge_bkd_iter_(LG) n(e);
for_all(e)
{
//std::cout << "== e.id() = " << e.id() << std::endl;
@@ -138,10 +142,9 @@ int main ()
}
}
-
{
- mln_vertex_fwd_iter_(util::graph) v(g);
- mln_vertex_nbh_vertex_fwd_iter_(util::graph) n(v);
+ mln_vertex_fwd_iter_(LG) v(lg);
+ mln_vertex_nbh_vertex_fwd_iter_(LG) n(v);
for_all(v)
{
unsigned i = 0;
@@ -151,8 +154,8 @@ int main ()
}
}
{
- mln_vertex_bkd_iter_(util::graph) v(g);
- mln_vertex_nbh_vertex_bkd_iter_(util::graph) n(v);
+ mln_vertex_bkd_iter_(LG) v(lg);
+ mln_vertex_nbh_vertex_bkd_iter_(LG) n(v);
for_all(v)
{
unsigned i = v.nmax_nbh_vertices();
@@ -160,5 +163,5 @@ int main ()
--i;
mln_assertion(i == 0);
}
- }*/
+ }
}
--
1.5.6.5