react-sigma icon indicating copy to clipboard operation
react-sigma copied to clipboard

Reload sigma graph with new layout?

Open michaelbdavid opened this issue 3 years ago • 1 comments

Can someone point me to a way to force sigma to refresh with a new layout? It seems that after first layout can not get sigma to recalculate node positions and relayout.

I tried doing something like:

const forcePositions = forceAtlas2(graph, { iterations: 50 });
graph.forEachNode((node, attributes) => {
    graph.updateNodeAttribute(node, 'x', () => forcePositions[node].x);
                 graph.updateNodeAttribute(node, 'y', () => forcePositions[node].y);
        });

sigma.refresh();

node x and y are updated but sigma remains the same, even with sigma.refresh();

michaelbdavid avatar Oct 31 '22 20:10 michaelbdavid

any thoughts on this?

michaelbdavid avatar Jan 04 '23 23:01 michaelbdavid