score:14

Accepted answer

From the documentation:

force.linkDistance([distance])

If distance is specified, sets the target distance between linked nodes to the specified value. If distance is not specified, returns the layout's current link distance, which defaults to 20. If distance is a constant, then all links are the same distance. Otherwise, if distance is a function, then the function is evaluated for each link (in order), being passed the link and its index, with the this context as the force layout; the function's return value is then used to set each link's distance. The function is evaluated whenever the layout starts. Typically, the distance is specified in pixels; however, the units are arbitrary relative to the layout's size.

Note that the link distance is still adjusted as the layout runs. You may also find setting linkStrength() useful.

score:7

Just two steps:

Step1: Add a parameter in main json as follows:

{source: "Microsoft", target: "Amazon", type: "licensing", value: 60}, {source: "Microsoft", target: "HTC", type: "licensing",value: 60}, {source: "Samsung", target: "Apple", type: "suit",value:60},

Step2: Update linkdistance to accept method.

.linkDistance(function(d) { return  d.value; }) 

Related Query