diff --git a/include/hpp/manipulation/graph/graph.hh b/include/hpp/manipulation/graph/graph.hh
index 7068dc76fe45dd2e8702709df8acc828c8089778..d59bad99b4be11d43d8ce3e5dc7b5395b6600fed 100644
--- a/include/hpp/manipulation/graph/graph.hh
+++ b/include/hpp/manipulation/graph/graph.hh
@@ -52,6 +52,12 @@ namespace hpp {
           /// Create and insert a NodeSelector inside the graph.
           NodeSelectorPtr_t createNodeSelector (const std::string& name);
 
+          /// Set the nodeSelector
+          /// \warning This should be done before adding nodes to the node
+          /// selector otherwise the pointer to the parent graph will NOT be
+          /// valid.
+          void nodeSelector (NodeSelectorPtr_t ns);
+
           /// Returns the states of a configuration.
           NodePtr_t getNode (ConfigurationIn_t config) const;
 
diff --git a/src/graph/graph.cc b/src/graph/graph.cc
index 3913979fdbd70b767651f94588829a6b8d0f4efa..cbc2bc33aa0b20aa761f044bfadcba5d33baaa14 100644
--- a/src/graph/graph.cc
+++ b/src/graph/graph.cc
@@ -48,6 +48,12 @@ namespace hpp {
         return nodeSelector_;
       }
 
+      void Graph::nodeSelector (NodeSelectorPtr_t ns)
+      {
+        nodeSelector_ = ns;
+        nodeSelector_->parentGraph (wkPtr_);
+      }
+
       void Graph::maxIterations (size_type iterations)
       {
         maxIterations_ = iterations;