admin管理员组文章数量:1130349
I am trying to create a d3 force-directed graph (.html). Here is the simple JSON file containing my data.
{"nodes":[{"name":"Node1","group":1}, {"name":"Node2","group":1}],
"links":[{"source":1,"target":2,"value":2}]}
I have two nodes in the same group. I am trying to also create a link between the two nodes. However, my page remains blank (and I am sure that other parts other than the JSON are correct).
What is a "group"? Why do edges have both a "source" and a "target" - and what are these values? Why do links have a "value"? Aren't the links just unweighted edges? I'm having trouble understand the JSON structure of data storage.
I am trying to create a d3 force-directed graph (http://mbostock.github./d3/ex/force.html). Here is the simple JSON file containing my data.
{"nodes":[{"name":"Node1","group":1}, {"name":"Node2","group":1}],
"links":[{"source":1,"target":2,"value":2}]}
I have two nodes in the same group. I am trying to also create a link between the two nodes. However, my page remains blank (and I am sure that other parts other than the JSON are correct).
What is a "group"? Why do edges have both a "source" and a "target" - and what are these values? Why do links have a "value"? Aren't the links just unweighted edges? I'm having trouble understand the JSON structure of data storage.
Share Improve this question edited Jun 16, 2014 at 15:26 VividD 10.5k8 gold badges66 silver badges112 bronze badges asked Apr 6, 2012 at 2:11 dangerChihuahua007dangerChihuahua007 20.9k38 gold badges128 silver badges211 bronze badges1 Answer
Reset to default 8In the d3 force-directed graph example, the 'value' of links is mapped to the stroke width of the edges and the 'group' of nodes is mapped to the color of the nodes. The integer value of 'source' and 'target' in links refers to the array index of the corresponding node in nodes (https://github./mbostock/d3/wiki/Force-Layout#wiki-links).
If you change source links to
"links":[{"source":0,"target":1,"value":2}]}
it, d3 should render an edge between the two nodes.
I am trying to create a d3 force-directed graph (.html). Here is the simple JSON file containing my data.
{"nodes":[{"name":"Node1","group":1}, {"name":"Node2","group":1}],
"links":[{"source":1,"target":2,"value":2}]}
I have two nodes in the same group. I am trying to also create a link between the two nodes. However, my page remains blank (and I am sure that other parts other than the JSON are correct).
What is a "group"? Why do edges have both a "source" and a "target" - and what are these values? Why do links have a "value"? Aren't the links just unweighted edges? I'm having trouble understand the JSON structure of data storage.
I am trying to create a d3 force-directed graph (http://mbostock.github./d3/ex/force.html). Here is the simple JSON file containing my data.
{"nodes":[{"name":"Node1","group":1}, {"name":"Node2","group":1}],
"links":[{"source":1,"target":2,"value":2}]}
I have two nodes in the same group. I am trying to also create a link between the two nodes. However, my page remains blank (and I am sure that other parts other than the JSON are correct).
What is a "group"? Why do edges have both a "source" and a "target" - and what are these values? Why do links have a "value"? Aren't the links just unweighted edges? I'm having trouble understand the JSON structure of data storage.
Share Improve this question edited Jun 16, 2014 at 15:26 VividD 10.5k8 gold badges66 silver badges112 bronze badges asked Apr 6, 2012 at 2:11 dangerChihuahua007dangerChihuahua007 20.9k38 gold badges128 silver badges211 bronze badges1 Answer
Reset to default 8In the d3 force-directed graph example, the 'value' of links is mapped to the stroke width of the edges and the 'group' of nodes is mapped to the color of the nodes. The integer value of 'source' and 'target' in links refers to the array index of the corresponding node in nodes (https://github./mbostock/d3/wiki/Force-Layout#wiki-links).
If you change source links to
"links":[{"source":0,"target":1,"value":2}]}
it, d3 should render an edge between the two nodes.
本文标签:
版权声明:本文标题:javascript - What do the nodes, groups, and values mean in the JSON for a d3 force-directed graph? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1742089079a1910564.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论