Adding data for relationships

Now, let's create the relationships by adding the following array to the bottom of app.js. Note that the attributes must be source and target, in order for D3 to do its magic:

var linksData = [
    {"source": "Charlie", "target": "Mac"},    {"source": "Dennis", "target": "Mac"},    {"source": "Dennis", "target": "Dee"},    {"source": "Dee", "target": "Mac"},    {"source": "Dee", "target": "Frank"},    {"source": "Cricket", "target": "Dee"}];

Get D3.js Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.