     ###
 
     if (d.outlinks?)
-      flows.selectAll("line.out")
-          .data(d.outlinks) #.filter (d) -> flowLineValue(d) > 0)
-        .enter().append("svg:line")
+      outflow = flows.selectAll("line.out")
+          .data(d.outlinks, (d) -> d.target[conf.nodeIdAttr]) #.filter (d) -> flowLineValue(d) > 0)
+        
+      outflow.exit().remove()
+
+      outflow.enter().append("svg:line")
           .attr("class", "out")
-          #.attr("stroke", outboundColor)
           .attr("opacity", 0)
           .transition()
             .duration(300)



    if (d.inlinks?)
      flows.selectAll("line.in")
          .data(d.inlinks) #.filter (d) -> flowLineValue(d) > 0)
        .enter().append("svg:line")
          .attr("class", "in")
          #.attr("stroke", inboundColor)
          #.attr("opacity",0.5)
          .attr("opacity", 0)
          .transition()
            .duration(300)

    update()



    if selectedNode?
      if nodes.nodeById(d3.select(selectedNode).datum()[conf.nodeIdAttr])?
        showFlowsOf(selectedNode)
        
      else        
        # selected node does not have any flows
        flows.selectAll("line").remove()


    clearNodeSelection = ->
      if selectedNode?
        d3.select(selectedNode).selectAll("circle").classed("selected", false)
        flows.selectAll("line").remove()
        selectedNode = null


    unless isUpdate

      $(document).keyup (e) -> if e.keyCode == 27 then clearNodeSelection()

      $('g.bubble').tipsy
        gravity: 'w'
        html: true
        opacity: 0.9
        trigger: "manual"
        title: -> bubbleTooltip(d3.select(this).data()[0])


    ###
