       .attr('id', (d) -> return 'relation-'+d.id)
       .attr 'class',        (d) -> return if d.disabled then 'relation disabled' else 'relation'
 
-    @relations = @relations_cont.selectAll('.relation')
-
+    @relations = @container_inner.selectAll('.relation')
 
   updateNodesLabels: ->
-    # Use General Update Pattern I (https://bl.ocks.org/mbostock/3808218)
-
-    # DATA JOIN
-    # @nodes_labels = @nodes_labels_cont.selectAll('.node-label').data(@data_nodes)
-
-    # # ENTER
-    # @nodes_labels.enter().append('text')
-    #   .attr 'id',     (d,i) -> return 'node-label-'+d.id
-    #   .attr 'dx',     0
-    #   .attr 'dy',     @getNodeLabelYPos
-
-    # # ENTER + UPDATE
-    # @nodes_labels
-    #   .attr 'class', @getNodeLabelClass
-    #   .text (d) -> return d.name
-    #   .call @formatNodesLabels
-
-    # # EXIT
-    # @nodes_labels.exit().remove()
+    # Use General Update Pattern 4.0 (https://bl.ocks.org/mbostock/a8a5baa4c4a470cda598)
+
+    # JOIN new data with old elements
+    @nodes_labels = @container_inner.selectAll('.node-label').data(@data_nodes)
+
+    # EXIT old elements not present in new data
+    @nodes_labels.exit().remove()
+
+    # UPDATE old elements present in new data
+    @nodes_labels
+      .attr 'class', @getNodeLabelClass
+      .text (d) -> return d.name
+      .call @formatNodesLabels
+
+    # ENTER new elements present in new data.
+    @nodes_labels.enter().append('text')
+      .attr 'id',     (d,i) -> return 'node-label-'+d.id
+      .attr 'class',  @getNodeLabelClass
+      .attr 'dx',     0
+      .attr 'dy',     @getNodeLabelYPos
+      .text (d) -> return d.name
+      .call @formatNodesLabels
+
+    @nodes_labels = @container_inner.selectAll('.node-label')
 
   updateRelationsLabels: ->
     # Use General Update Pattern I (https://bl.ocks.org/mbostock/3808218)
 
     # DATA JOIN
-    # @relations_labels = @relations_labels_cont.selectAll('.relation-label').data(@data_relations_visibles)
+    # @relations_labels = @container_inner.selectAll('.relation-label').data(@data_relations_visibles)
 
     # # ENTER
     # @relations_labels.enter()

    #@force.size [@viewport.width, @viewport.height]

  rescale: ->
    @container.attr 'transform', @getContainerTransform()
    translateStr = 'translate(' + (-@viewport.center.x) + ',' + (-@viewport.center.y) + ')'
    @relations_cont.attr        'transform', translateStr
    @relations_labels_cont.attr 'transform', translateStr
    @nodes_cont.attr            'transform', translateStr
    @nodes_labels_cont.attr     'transform', translateStr
 
  setOffsetX: (offset) ->
    @viewport.offsetx = if offset < 0 then 0 else offset


  focusNode: (node)->
    @unfocusNode()
    @container.selectAll('#node-'+node.id).classed('active', true)

  unfocusNode: ->
    @container.selectAll('.node.active').classed('active', false)


  # Resize Methods
