kieler / klayjs

(deprecated) KIELER's layout algorithms for JavaScript
Eclipse Public License 1.0
231 stars 22 forks source link

Tips for improving efficiency #19

Open robclouth opened 8 years ago

robclouth commented 8 years ago

I'm making a patching environment for real-time graphics for mobile, and I want the graph to have the autolayout so that it's always clean and consistent. This means that every time you add a new node or edges, it should apply the layout algorithm. However, when the graph gets beyond a certain size the layouting gets slower and slower until doing it every change is unrealistic.

Are there ways of only laying out certain parts? Just the parts that have changed instead of calculating the layout of the whole graph even if most of it doesn't change.

Which of the layout options is the most efficient?

How big a graph would you expect to have calculation time of less than half a second?

Thanks!

le-cds commented 8 years ago

I'm not exactly the JavaScript person in the project, so I'll answer the question from a non-JavaScript point of view.

Are there ways of only laying out certain parts?

No, we currently don't have any layout algorithms that support this kind of thing.

Which of the layout options is the most efficient?

The following settings should improve the algorithm's performance:

de.cau.cs.kieler.klay.layered.nodeLayering: LONGEST_PATH
de.cau.cs.kieler.klay.layered.greedySwitch: OFF

You can also try the following setting, but I'm not sure if that will actually improve performance since the default setting should already be quite fast:

de.cau.cs.kieler.klay.layered.nodePlacement: LINEAR_SEGMENTS

How big a graph would you expect to have calculation time of less than half a second?

That's a bit hard to answer. In general, layout performance not only depends on the number of nodes, but also on the number of edges and the graph's general structure. Having said that, I would expect layout to take less than half a second for up to a couple of hundred nodes with a reasonable number of connections. On desktop computers, that is. I don't have any point of reference for mobile devices. See ticket #15 for another discussion on algorithm performance.

forresto commented 8 years ago

@robclouth Have you tried running klay in a worker? https://github.com/OpenKieler/klayjs#web-worker