kieler / klayjs

(deprecated) KIELER's layout algorithms for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Time Savings with Interactive Mode

dustinsanders opened this issue · comments

I'm using klay to render large graphs (~400 nodes) and this is taking around 7 seconds. I was wondering if there is any mechanism to take into account previous positions when adding another node as to not incur the entire cost of the layout algorithm. In example if I had a graph of 400 nodes graphed and want to add another node to the graph.

I saw the interactive mode example and this seems promising, but just wanted to see if this is possible before I get started.

The interactive mode still runs the whole layout algorithm, i.e. all five phases. Still, the interactive strategies may be less costly than the sophisticated implementations. So you could give it a try. You would have to determine reasonable positions for your new nodes yourself though. Otherwise they won't be placed properly. Maybe you can select a handful of nodes that are related to the new node, layout this small sub-graph and use the relative position of the new node for your interactive layout.

7 seconds is a long time for 400 nodes. I am wondering if this is due to your graph structure or javascript. Can you share your example so I can give it a try with the Java version?

Let me know if this doesn't work

I gave it a try in java and even there it takes about 2s. The reason is that your graph contains quite a lot of long edges which are turned into dummy nodes internally. For your instance about 7200 dummy nodes are created. The following two options should speed up the process significantly, down to 400ms in java.
For the second option you'll need existing y-coordinates though (assuming left-to-right layout).

    de.cau.cs.kieler.klay.layered.greedySwitch: OFF
    de.cau.cs.kieler.klay.layered.crossMin: INTERACTIVE