score:1

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 = [
{"name":"node1","group":"2"},
{"name":"node2","group":"4"},
{"name":"node3","group":"5"}]

Check out this example: https://jsfiddle.net/4xt5v51m/

score:2

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