27 #ifndef MLN_UTIL_VERTEX_HH
28 # define MLN_UTIL_VERTEX_HH
31 # include <mln/util/graph_ids.hh>
32 # include <mln/util/internal/vertex_impl.hh>
33 # include <mln/core/concept/proxy.hh>
34 # include <mln/core/concept/site.hh>
35 # include <mln/util/graph_ids.hh>
36 # include <mln/util/edge.hh>
48 namespace util {
template<
typename G>
class vertex; }
49 namespace util {
template<
typename G>
class edge; }
72 :
public Site< vertex<G> >,
91 explicit vertex(
const G& g);
128 const G&
graph()
const;
144 template <
typename G>
146 operator<<(std::ostream& ostr, const vertex<G>& v);
174 template <
typename G,
typename E>
184 const G& graph()
const;
189 unsigned nmax_nbh_edges()
const;
191 unsigned nmax_nbh_vertices()
const;
195 const E& exact_()
const;
198 template <
typename G,
typename E>
203 void change_graph(
const G& g);
219 # ifndef MLN_INCLUDE_ONLY
227 template <
typename G>
234 template <
typename G>
263 return id_ != mln_max(
unsigned) && g_.is_valid() && g_.has_v(id_);
271 id_ = mln_max(
unsigned);
279 mln_precondition(g_.has_v(id_));
280 mln_precondition(g_.has_e(id_e));
281 mln_precondition(g_.v1(id_e) == id_ || g_.v2(id_e) == id_);
282 return g_.v_other(id_e, id_);
290 mln_precondition(g_.has_v(id_));
291 return g_.v_ith_nbh_edge(id_, i);
299 mln_precondition(g_.has_v(id_));
300 return g_.v_nmax_nbh_edges(id_);
308 mln_precondition(g_.has_v(id_));
309 return g_.v_ith_nbh_vertex(id_, i);
317 mln_precondition(g_.has_v(id_));
318 return g_.v_nmax_nbh_vertices(id_);
326 mln_precondition(g_.has_v(id_));
327 mln_precondition(g_.has_v(v));
328 return g_.edge(*
this, v);
336 mln_precondition(g.is_valid());
372 template <
typename G>
375 operator<<(std::ostream& ostr, const vertex<G>& v)
377 return ostr << v.id();
385 return v1.id() == v2.id()
386 && (v1.graph().is_subgraph_of(v2.graph())
387 || v2.graph().is_subgraph_of(v1.graph()));
395 return lhs.id() <
rhs.id();
408 template <
typename G,
typename E>
413 return internal::force_exact<const E>(*this);
416 template <
typename G,
typename E>
421 return exact_().get_subject().graph();
424 template <
typename G,
typename E>
429 return exact_().get_subject().id();
434 template <
typename G,
typename E>
439 return exact_().get_subject().other(id_e);
442 template <
typename G,
typename E>
447 return exact_().get_subject().ith_nbh_edge(i);
450 template <
typename G,
typename E>
455 return exact_().get_subject().nmax_nbh_edges();
458 template <
typename G,
typename E>
463 return exact_().get_subject().ith_nbh_vertex(i);
466 template <
typename G,
typename E>
471 return exact_().get_subject().nmax_nbh_vertices();
474 template <
typename G,
typename E>
479 return exact_().get_subject().edge_with(v);
487 template <
typename G,
typename E>
492 return internal::force_exact<E>(*this);
495 template <
typename G,
typename E>
500 exact_().get_subject().invalidate();
503 template <
typename G,
typename E>
508 exact_().get_subject().change_graph(g);
511 template <
typename G,
typename E>
516 exact_().get_subject().update_id(
id);
523 # endif // ! MLN_INCLUDE_ONLY
526 #endif // ! MLN_UTIL_VERTEX_HH