I have a huge graph that uses the LayeredDiagraphLayout. I would like it to only render the nodes that are visible. From this example I realised that I have to do it myself (which I don’t like, but that’s a different discussion).
I can’t seem to understand which methods I have to overwrite and how. I’ve also checked this topic, but I don’t understand any of it.
So, I need to improve the performance of LayeredDiagraphLayout and I think making it virtual may improve it. Where do I even start? I don’t know how LayeredDiagraphLayout works (I don’t have the source code).
How many nodes and links are in your “huge graph”? If it’s more than a few hundred each, then LayeredDigraphLayout will just be too slow. Virtualization helps with the initial start-up time when there would be a lot of nodes and links, but it does not make the chosen layout any faster.
Well, I first render the graph with fewer nodes now, so it doesn’t break and then when I want to see the whole model, with all those nodes, it takes like 5-10 seconds to render, during which the browser is sort of frozen.
Some day we will write a new layout that is a lot faster and still covers the same cases. But this will be a significant undertaking, so it will not happen soon. In the meantime, I suppose you could try setting LayeredDigraphLayout.packOption to various values to see if the time is faster and yet the results are reasonable.
I still don’t know what your graphs are supposed to look like, so it’s hard to guess. But I’ll start by suggesting: