As stated by Romain and assuming you are indeed working with a directed graph, you can group the nodes by assigning a number to each node in your data.

var nodes = [

Check out this example:


A a follow up to nrabinowitz, in a graph you don't have parent/child relationships. You do in a directed graph, such as a tree.

Related Query