Commit d53b4271 authored by Roland Levillain's avatar Roland Levillain
Browse files

Miscellaneous changes in graphs and graph-based images.

	* mln/util/graph.hh,
	* mln/util/line_graph.hh,
	* mln/core/image/vertex_image.hh,
	* mln/core/image/edge_image.hh:
	Fix the Doxygen documentation.
	* mln/util/vertex.hh: Aesthetic changes.
	* mln/util/edge.hh: Aesthetic changes.
	(util::edge<G>::invalidate): Remove dead code.
	* tests/morpho/line_graph_image_morpho.cc:
	Fix (non) Doxygen comments.
parent 17734ea5
2010-05-11 Roland Levillain <roland@lrde.epita.fr>
Miscellaneous changes in graphs and graph-based images.
* mln/util/graph.hh,
* mln/util/line_graph.hh,
* mln/core/image/vertex_image.hh,
* mln/core/image/edge_image.hh:
Fix the Doxygen documentation.
* mln/util/vertex.hh: Aesthetic changes.
* mln/util/edge.hh: Aesthetic changes.
(util::edge<G>::invalidate): Remove dead code.
* tests/morpho/line_graph_image_morpho.cc:
Fix (non) Doxygen comments.
2010-05-11 Roland Levillain <roland@lrde.epita.fr>
 
Fix make::edge_image.
......@@ -160,7 +160,7 @@ namespace mln
/// Constructors.
/// @{
/// \{
edge_image();
edge_image(const p_edges<G, site_function_t>& pe);
edge_image(const Graph<G>& g,
......@@ -178,13 +178,13 @@ namespace mln
template <typename FV>
edge_image(const p_edges<G,site_function_t>& pe,
const Function_v2v<FV>& edge_values);
/// @}
/// \}
/// Value accessors/operators overloads.
/// @{
/// \{
rvalue operator()(unsigned e_id) const;
lvalue operator()(unsigned e_id);
/// @}
/// \}
// Just to help g++-2.95...
rvalue operator()(const psite& p) const;
......
......@@ -167,7 +167,7 @@ namespace mln
/// Constructors.
/// @{
/// \{
vertex_image();
vertex_image(const p_vertices<G, site_function_t>& pv);
vertex_image(const p_vertices<G, site_function_t>& pv,
......@@ -175,13 +175,13 @@ namespace mln
template <typename FV>
vertex_image(const p_vertices<G, site_function_t>& pv,
const Function_v2v<FV>& vertex_values);
/// @}
/// \}
/// Value accessors/operators overloads.
/// @{
/// \{
rvalue operator()(unsigned v_id) const;
lvalue operator()(unsigned v_id);
/// @}
/// \}
// Just to help g++-2.95...
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -174,7 +175,7 @@ namespace mln
namespace internal
{
/// subject_impl specialization (Proxy)
/// subject_impl specialization (Proxy).
/// \{
template <typename G, typename E>
......@@ -199,7 +200,7 @@ namespace mln
};
template <typename G, typename E>
struct subject_impl< util::edge<G>, E > :
struct subject_impl< util::edge<G>, E > :
subject_impl< const util::edge<G>, E >
{
void update_id(const util::edge_id_t& id);
......@@ -218,10 +219,6 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
/*---------------------.
| Operators on edges. |
`---------------------*/
namespace util
{
......@@ -308,7 +305,6 @@ namespace mln
void
edge<G>::invalidate()
{
//id_ = mln_max(unsigned);
id_.invalidate();
}
......@@ -391,9 +387,9 @@ namespace mln
namespace internal
{
/*----------------------------------`
| subject_impl< const util::edge<G> |
\----------------------------------*/
/*-----------------------------------------.
| subject_impl< const util::edge<G>, E >. |
`-----------------------------------------*/
template <typename G, typename E>
inline
......@@ -460,14 +456,14 @@ namespace mln
}
/*----------------------------------`
| subject_impl< util::edge<G> |
\----------------------------------*/
/*-----------------------------------.
| subject_impl< util::edge<G>, E >. |
`-----------------------------------*/
template <typename G, typename E>
inline
void
subject_impl< util::edge<G>, E >::update_id(const util::edge_id_t& id)
subject_impl< util::edge<G>, E >::update_id(const util::edge_id_t& id)
{
return exact_().get_subject().update_id(id);
}
......@@ -475,7 +471,7 @@ namespace mln
template <typename G, typename E>
inline
void
subject_impl< util::edge<G>, E >::change_graph(const mlc_const(G)& g)
subject_impl< util::edge<G>, E >::change_graph(const mlc_const(G)& g)
{
return exact_().get_subject().change_graph(g);
}
......@@ -483,7 +479,7 @@ namespace mln
template <typename G, typename E>
inline
void
subject_impl< util::edge<G>, E >::invalidate()
subject_impl< util::edge<G>, E >::invalidate()
{
return exact_().get_subject().invalidate();
}
......
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -47,7 +48,7 @@ namespace mln
namespace internal
{
/// Data structure for \c mln::image2d<T>.
/// Data structure for mln::util::graph.
template <>
struct data<util::graph>
{
......@@ -165,9 +166,11 @@ namespace mln
/// \}
/// Return the number of vertices in the graph.
// FIXME: Rename as nvertices.
size_t v_nmax() const;
/// Check whether a vertex id \p id_v exists in the graph.
// FIXME: Is the `_v' suffix really needed?
bool has_v(const vertex_id_t& id_v) const;
......@@ -205,12 +208,12 @@ namespace mln
const std::vector<util::ord_pair<vertex_id_t> >& edges() const;
/// Return the number of edges in the graph.
// FIXME: Rename as nedges.
size_t e_nmax() const;
/// Return whether \p id_e is in the graph.
/// \@{
// FIXME: Is the `_e' suffix really needed?
bool has_e(const edge_id_t& id_e) const;
/// \@}
/// Return the corresponding edge id if exists. If it is not, returns
/// an invalid edge.
......@@ -287,9 +290,9 @@ namespace mln
this->data_ = new mln::internal::data<util::graph>(nvertices);
}
/*---------------.
| Vertex related |
`---------------*/
/*--------------------------.
| Vertex-related services. |
`--------------------------*/
inline
unsigned
......@@ -374,9 +377,9 @@ namespace mln
}
/*--------------.
| Edges related |
`---------------*/
/*-------------------------.
| Edges-related services. |
`-------------------------*/
inline
edge_id_t
......@@ -388,6 +391,8 @@ namespace mln
// Does this edge already exist in the graph?
edge_data_t edge(id_v1, id_v2);
/* FIXME: This is not sound: the behavior of the algorithm
changes when NDEBUG is defined. */
# ifndef NDEBUG
if (data_->edges_set_.find(edge) != data_->edges_set_.end ())
{
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -28,7 +29,7 @@
/// \file
///
/// Definitions of undirected graphs.
/// Definition of an (undirected) line graph (adaptor).
# include <mln/util/internal/graph_base.hh>
# include <mln/util/internal/graph_iter.hh>
......@@ -49,7 +50,7 @@ namespace mln
namespace internal
{
/// Data structure for \c mln::image2d<T>.
/// Data structure for mln::util::line_graph<G>.
template <typename G>
struct data< util::line_graph<G> >
{
......@@ -157,11 +158,14 @@ namespace mln
/// \}
/// Return the number of vertices in the graph.
// FIXME: Rename as nvertices.
size_t v_nmax() const;
/// Check whether a vertex id \p id_v exists in the graph.
/// Check whether a vertex id \p id_v exists in the line graph.
// FIXME: Is the `_v' suffix really needed?
bool has_v(const vertex_id_t& id_v) const;
/// Check whether an edge \p v exists in the graph.
/// Check whether a vertex \p v exists in the line graph.
template <typename G2>
bool has(const util::vertex<G2>& v) const;
......@@ -188,12 +192,14 @@ namespace mln
edge_t edge(const edge_id_t& e) const;
/// Return the number of edges in the graph.
// FIXME: Rename as nedges.
size_t e_nmax() const;
/// Return whether \p id_e is in the graph.
/// Return whether \p id_e is in the line graph.
// FIXME: Is the `_e' suffix really needed?
bool has_e(const util::edge_id_t& id_e) const;
/// Return whether \p e is in the graph.
/// Return whether \p e is in the line graph.
template <typename G2>
bool has(const util::edge<G2>& e) const;
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -165,8 +165,8 @@ namespace mln
namespace internal
{
/// subject_impl specialization (Proxy).
/// \{
/// subject_impl specialization (Proxy)
template <typename G, typename E>
struct subject_impl< const util::vertex<G>, E >
......@@ -174,6 +174,8 @@ namespace mln
// Can't be provided since there is an ambiguity with the iterator's
// member.
//
// FIXME: Check the above statement again, as a naive test does
// not exhibit its conclusion.
// bool is_valid() const;
const G& graph() const;
......@@ -191,7 +193,7 @@ namespace mln
};
template <typename G, typename E>
struct subject_impl< util::vertex<G>, E > :
struct subject_impl< util::vertex<G>, E > :
subject_impl< const util::vertex<G>, E >
{
void invalidate();
......@@ -396,6 +398,10 @@ namespace mln
namespace internal
{
/*-------------------------------------------.
| subject_impl< const util::vertex<G>, E >. |
`-------------------------------------------*/
template <typename G, typename E>
inline
const E&
......@@ -471,10 +477,14 @@ namespace mln
}
/*-------------------------------------.
| subject_impl< util::vertex<G>, E >. |
`-------------------------------------*/
template <typename G, typename E>
inline
E&
subject_impl< util::vertex<G>, E >::exact_()
subject_impl< util::vertex<G>, E >::exact_()
{
return internal::force_exact<E>(*this);
}
......@@ -482,7 +492,7 @@ namespace mln
template <typename G, typename E>
inline
void
subject_impl< util::vertex<G>, E >::invalidate()
subject_impl< util::vertex<G>, E >::invalidate()
{
exact_().get_subject().invalidate();
}
......@@ -490,7 +500,7 @@ namespace mln
template <typename G, typename E>
inline
void
subject_impl< util::vertex<G>, E >::change_graph(const G& g)
subject_impl< util::vertex<G>, E >::change_graph(const G& g)
{
exact_().get_subject().change_graph(g);
}
......@@ -498,7 +508,7 @@ namespace mln
template <typename G, typename E>
inline
void
subject_impl< util::vertex<G>, E >::update_id(const util::vertex_id_t& id)
subject_impl< util::vertex<G>, E >::update_id(const util::vertex_id_t& id)
{
exact_().get_subject().update_id(id);
};
......
......@@ -77,8 +77,8 @@ int main()
g.add_edge(3, 4);
g.add_edge(4, 2);
/// Create the corresponding line graph.
/// Edges are now considered as vertices.
// Create the corresponding line graph.
// Edges are now considered as vertices.
util::line_graph<util::graph> lg(g);
// Points associated to the line graph vertices (edges in the graph).
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment