Skip to content
Snippets Groups Projects
Commit c6fb6381 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Edge can have negative weights in which case they are hidden

parent 3c0cf959
No related branches found
No related tags found
No related merge requests found
...@@ -55,9 +55,18 @@ namespace hpp { ...@@ -55,9 +55,18 @@ namespace hpp {
static NodePtr_t create (const std::string& name); static NodePtr_t create (const std::string& name);
/// Create a link from this node to the given node. /// Create a link from this node to the given node.
/// \deprecated Use Edge->node(NodePtr_t) to give the node.
EdgePtr_t linkTo (const std::string& name, const NodePtr_t& to, EdgePtr_t linkTo (const std::string& name, const NodePtr_t& to,
const Weight_t& w = 1, const Weight_t& w = 1,
const bool& isInNodeFrom = false, const bool& isInNodeFrom = false,
EdgeFactory create = Edge::create)
HPP_MANIPULATION_DEPRECATED;
/// Create a link from this node to the given node.
/// \param w if strictly negative, the edge is not included in the neighbor
/// list. Otherwise, it is included with Weight_t w
EdgePtr_t linkTo (const std::string& name, const NodePtr_t& to,
const size_type& w = 1,
EdgeFactory create = Edge::create); EdgeFactory create = Edge::create);
/// Check whether the configuration is in this state. /// Check whether the configuration is in this state.
...@@ -156,6 +165,7 @@ namespace hpp { ...@@ -156,6 +165,7 @@ namespace hpp {
/// List of possible motions from this state (i.e. the outgoing /// List of possible motions from this state (i.e. the outgoing
/// vertices). /// vertices).
Neighbors_t neighbors_; Neighbors_t neighbors_;
std::vector <EdgePtr_t> hiddenNeighbors_;
/// Set of constraints to be statisfied. /// Set of constraints to be statisfied.
typedef Cache < ConstraintSetPtr_t > Constraint_t; typedef Cache < ConstraintSetPtr_t > Constraint_t;
......
...@@ -60,6 +60,15 @@ namespace hpp { ...@@ -60,6 +60,15 @@ namespace hpp {
return newEdge; return newEdge;
} }
EdgePtr_t Node::linkTo(const std::string& name, const NodePtr_t& to,
const size_type& w, EdgeFactory create)
{
EdgePtr_t newEdge = create(name, graph_, wkPtr_, to);
if (w >= 0) neighbors_.insert (newEdge, (Weight_t)w);
else hiddenNeighbors_.push_back (newEdge);
return newEdge;
}
bool Node::contains (ConfigurationIn_t config) const bool Node::contains (ConfigurationIn_t config) const
{ {
return configConstraint()->isSatisfied (config); return configConstraint()->isSatisfied (config);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment