Here is a simple way to achieve this:
node = node
.data(nodes.filter(function(n) { return !n.children; }))
.enter()
.append('a')
.attr("xlink:href", 'http://www.google.com' /*function(d){return d.url;}*/)
.append("text")
.attr("class", "node")
...
I commented out code that would make the link based on data (i.e. you would have an url field in your input data).
Per request, example of url in data:
"children": [
{
"name": "John Doe",
"size": 1458,
"url": "http://www.johndoe.com"
...