"facebookId": 100003252256072,
"facebookId": 104088302962435,
"name": "Carlton Lassiter",
"parent": "Shawn Spencer",
"facebookId": 126495827393151
"facebookId": 100002858896488
var tree = d3.layout.tree().size([height, width])
var diagonal = d3.svg.diagonal().projection(function(d) {
var svg = d3.select('svg')
.attr('width', width + margin + margin)
.attr('height', height + margin + margin)
.attr('transform', 'translate(' + margin + ',' + margin + ')');
var defs = svg.append("defs").attr("id", "imgdefs");
var update = function(source) {
var nodes = tree.nodes(root).reverse(),
links = tree.links(nodes);
nodes.forEach(function(d) {
var node = svg.selectAll('g.node')
.data(nodes, function(d) {
return d.id || (d.id = ++count);
var nodeEnter = node.enter().append('g')
.attr('transform', function() {
return 'translate(' + source.y0 + ',' + source.x0 + ')';
.on('click', this.nodeClicked);
nodes.forEach(function(d, i) {
.attr('id', function(d) {
return 'clip-circle-' + i;
.attr('id', function(d) {
.attr('transform', function(d) {
return 'translate(' + d.y + ',' + d.x + ')';
nodeEnter.append('image')
.attr("xlink:href", function(d) {
return "https://graph.facebook.com/" + d.facebookId + "/picture";
.attr("clip-path", function(d, i) {
return "url(#clip-circle-" + i + ")";
return d.children || d._children ? -25 : 25;
.attr('text-anchor', function(d) {
return d.children || d._children ? 'end' : 'start';
.style('fill-opacity', 1e-6);
var nodeUpdate = node.transition()
.attr('transform', function(d) {
return 'translate(' + d.y + "," + d.x + ')';
nodeUpdate.select('circle')
nodeUpdate.select('text')
.style('fill-opacity', 1);
var nodeExit = node.exit().transition()
.attr('transform', function() {
return 'translate(' + source.y + ',' + source.x + ')';
.style('fill-opacity', 1e-6);
var link = svg.selectAll('path.link')
.data(links, function(d) {
link.enter().insert('path', 'g')
nodes.forEach(function(d) {