https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix the computation of neighbors in mln::line_graph_elt_neighborhood.
* mln/core/line_graph_elt_neighborhood.hh
(compute_neighbors_): Don't add the reference point to the set of
neighbors.
line_graph_elt_neighborhood.hh | 10 ++++++++++
1 file changed, 10 insertions(+)
Index: mln/core/line_graph_elt_neighborhood.hh
--- mln/core/line_graph_elt_neighborhood.hh (revision 1899)
+++ mln/core/line_graph_elt_neighborhood.hh (working copy)
@@ -40,6 +40,10 @@
- mln::line_graph_elt_window
- mln::line_graph_elt_neighborhood. */
+/* FIXME: Due to the poor interface of mln::p_line_graph and
+ mln::util::graph, we show to much implementation details here.
+ Enrich their interfaces to avoid that. */
+
# include <set>
# include <mln/core/concept/neighborhood.hh>
@@ -105,6 +109,7 @@
line_graph_elt_neighborhood<P>::compute_neighbors_(Point_Iterator<Piter>&
piter_) const
{
Piter& piter = exact(piter_);
+ util::edge_id ref_edge_id = piter.p_ref().id();
neighbors_t& neighbors = piter.neighbors();
neighbors.clear();
/* FIXME: Move this computation out of the window. In fact,
@@ -116,6 +121,9 @@
const util::node<P>& node1 = piter.plg().gr_->node(id1);
for (std::vector<util::edge_id>::const_iterator e =
node1.edges.begin(); e != node1.edges.end(); ++e)
+ /* We explicitely enforce that the reference piter edge id is
+ not inserted into NEIGHBORS. */
+ if (*e != ref_edge_id)
neighbors.insert(*e);
// Ajacent edges connected through node 2.
// FIXME: Likewise.
@@ -123,6 +131,8 @@
const util::node<P>& node2 = piter.plg().gr_->node(id2);
for (std::vector<util::edge_id>::const_iterator e =
node2.edges.begin(); e != node2.edges.end(); ++e)
+ // Same remark as above.
+ if (*e != ref_edge_id)
neighbors.insert(*e);
}