g.network.force() does not draw lines if .nodes() is used
Consider this example from https://learn.gramener.com/docs/g#force
<svg id="force-simple" width="50" height="50" style="border:1px solid #ccc"></svg>
<script>
var data = { // Data structure must have:
nodes: [{}, {}, {}], // - nodes: a list of node objects:
links: [{source: 0, target: 1}, // - links: a list of link objects:
{source: 1, target: 2}, // - each should have a source, target
{source: 2, target: 0}] // - as a nodes ID or reference to a node
}
var force = G.network.force() // Create the force layout
.data(data) // Pass it the network data
.draw('#force-simple') // Draw it on the SVG element
</script>
This creates the following output:
Just before the .draw()
at the end, add a .nodes(function() { return 1 })
.
That removes the lines.
The expected behaviour is that the lines should remain.