function buildNetwork(anchors, children) {
const edges = [];
const nodes = [...anchors];
children.forEach(({parent, items, alignment}) => {
const node = nodes.find(({id}) => id === parent);
items.forEach((item, i) => {
const id = `${parent}-${i+1}`
nodes.push({ id, positionX: node.positionX, positionY: node.positionY, count: i + 1, total: items.length, alignment})
edges.push({ source: node.id, target: id})
})
})
return [nodes, edges]
}