D3.js force力导向图用指定的字段确定link的source和target,默认是索引

    json.links.forEach(function (e) {
        var sourceNode = json.nodes.filter(function (n) {
                    return n.name === e.source;
                })[0],
                targetNode = json.nodes.filter(function (n) {
                    return n.name === e.target;
                })[0];
        e.source = sourceNode
        e.target = targetNode
    });

https://*.com/questions/23986466/d3-force-layout-linking-nodes-by-name-instead-of-index