27 #ifndef MLN_UTIL_INTERNAL_GRAPH_BASE_HH
28 # define MLN_UTIL_INTERNAL_GRAPH_BASE_HH
40 # include <mln/core/concept/object.hh>
41 # include <mln/core/concept/graph.hh>
42 # include <mln/core/concept/proxy.hh>
43 # include <mln/core/internal/data.hh>
45 # include <mln/util/edge.hh>
46 # include <mln/util/vertex.hh>
47 # include <mln/util/ord_pair.hh>
48 # include <mln/util/tracked_ptr.hh>
87 const void*
id()
const;
140 template <
typename E>
145 # ifndef MLN_INCLUDE_ONLY
172 return static_cast<const void*
>(data_.ptr_);
184 const E *g =
exact(
this);
185 mln_precondition(g->has_e(id_e));
186 mln_precondition(g->has_v(id_v));
187 mln_precondition(g->v1(id_e) == id_v
188 || g->v2(id_e) == id_v);
190 if (g->v1(id_e) == id_v)
204 return exact(
this)->has_v(v.id());
216 return exact(
this)->has_e(e.id());
220 template <
typename E>
228 template <
typename E>
246 const E *g =
exact(
this);
248 ostr <<
"graph: " << std::endl;
249 for (
unsigned v = 0; v < g->v_nmax(); ++v)
251 ostr <<
"vertex: " << v << std::endl <<
" -- adjacent vertices: ";
252 for (
unsigned n = 0; n < g->v_nmax_nbh_vertices(v); ++n)
253 ostr << g->v_ith_nbh_vertex(v, n) <<
" ";
258 ostr <<
"edges:" << std::endl;
259 for (
unsigned i = 0; i < g->e_nmax(); ++i)
260 ostr <<
"edge " << i <<
": ("
268 const util::tracked_ptr< mln::internal::data<E> >&
278 # endif // ! MLN_INCLUDE_ONLY
280 template <
typename E>
286 return lhs.
id() == rhs.
id();
291 #endif // ! MLN_UTIL_INTERNAL_GRAPH_BASE_HH