code: function(graph, pos, prop, flags) {
     var node = null;
     prop = prop || 'current';
     pos = pos && pos.getc(true) || Complex.KER;
     var distance = function(a, b) {
       var d1 = a.x - b.x, d2 = a.y - b.y;
       return d1 * d1 + d2 * d2;
     };
     this.eachNode(graph, function(elem) {
       node = (node == null || distance(elem.getPos(prop).getc(true), pos) < distance(
           node.getPos(prop).getc(true), pos)) ? elem : node;
     }, flags);
     return node;
    }
docs: /*
  Method: getClosestNodeToPos
  
  Returns the closest node to the given position.
  
  Also implemented by:
  
  <Graph>.
  
  Parameters:
  
  graph - (object) A <Graph> instance.
  pos - (object) A <Complex> or <Polar> instance.
  prop - (optional|string) Default's *current*. A <Graph.Node> position property. Possible properties are 'start', 'current' or 'end'.