Nodes and links in Collapsible Force Layout in D3 Javascript

969 Views Asked by At

I am new to D3 Javascript and currently following some tutorials to understand how it works. I have looked through the codes in this link: > http://bl.ocks.org/mbostock/1093130 for Collapsible Force Layout I have tried to figure out how nodes and links are connecting. Unfortunately, I could not fully understand on what basis the nodes are connected to each other. However, I have understood how these nods are connected in the Force-Directed Graph > The links between the nodes in Force-Directed Graph in D3 Javascript , I could not really understand how the links in Collapsible Force Layout is working. How are the id and target working? Is is based on the array index? Could anyone please explain to me how they are working? Your assistance would be more than appreciated.

1

There are 1 best solutions below

8
On BEST ANSWER

The links in the collapsible force layout example are based on parent-child relationships. That is, each node is connected to the nodes listed under .children.