One option I'm interested in is binary-streaming a graph and merging it into an existing graph instead of recreating / replacing, maybe with queueMicrotask steps to make it block less.
Discussion
Anything you can do to improve the performance will be awesome but if its not possible to make it faster then I'll look into wrapping it up in a worker so it at least does not block the thread
I made recalculateFollowDistances async, it now processes in batches of 1000 and uses queueMicrotask
Looks like that helped a lot. also I was calling the recalculate method every few seconds and it looks like thats not nessisary... so thats a x2 improvement right there :)
The only thing thats still causing the page to freeze is deserializing the graph. it takes about 3s on my machine
I haven't looked into it too much, but it looks like its the follow distance calculation that is taking the longest. do you think it would make sense to store the distance in the serialized graph in order to speed up load times?