Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messaging between nodes' position to optimise layout #258

Open
gg4u opened this issue Aug 29, 2020 · 0 comments
Open

Messaging between nodes' position to optimise layout #258

gg4u opened this issue Aug 29, 2020 · 0 comments

Comments

@gg4u
Copy link

gg4u commented Aug 29, 2020

Hello Andrei,

Much of the computations goes in the rendering part, and so I was looking at ways to improve efficiency.

Consider the situation of adding new neighbours, by tapping on a node: I noticed new nodes will be initially placed on the center of the graph container.
So, if a node is far away, the rendering will have to display all of the movements of pulling new elements close to the its parent node.

What about passing position parameters to new nodes, so that they are initialised on the same coordinates of the parent ?

I looked at:

       /**
        * Called by Viva.Graph.View.renderer to let concrete graphic output
        * provider prepare to render given node of the graph.
        *
        * @param nodeUI visual representation of the node created by node() execution.
        **/
        addNode : function (node, pos) {
            var nodeUI = nodeBuilder(node);
            if (!nodeUI) {
                return;
            }
            nodeUI.position = pos;
            nodeUI.node = node;
            allNodes[node.id] = nodeUI;

            svgContainer.appendChild(nodeUI);

            return nodeUI;
        },
 

and actually seems positions are passed, although note clear to me how to pass position when adding new nodes like:

graph.addNode(2)
or graph.addLink(1,2), graph.addLink(1,3), ..

  • Could you clarify how to pass custom position at the time of creating a node, before rendering it ?
    The effect I aim to is to initialise new nodes in a location already in a good position for force-layout adjustment, and thus avoiding pulling elements around the screen.

Thinking further, I thought this improvement may optimise force-directed layout for expanded on demand interaction,
because I expect that there new nodes' position will be already optimised by construction.

So I was researching about the idea of nodes passing messaging their own position for local adjustment, and coincidentally found out you also were exploring this part :

https://github.com/anvaka/nb/blob/master/src/nbLayout.js

  • Is neighbourhood beautification compliant as ngraph.layout alternative ? I saw it has dependencies as bounding box computation, I wonder if can be already used in Vivagraph or ngraph suite - please let me know if there are examples.
    Using svg renderer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant