Giter VIP home page Giter VIP logo

Comments (15)

maxkfranz avatar maxkfranz commented on August 15, 2024

@metincansiper Any idea why this would be happening? Thanks!

from cytoscape.js-cose-bilkent.

ugurdogrusoz avatar ugurdogrusoz commented on August 15, 2024

Regular layout starts with random positions; so this can only happen when all nodes are at the same position and incremental layout is enabled. One shouldn't run incremental layout when nodes don't really have any initial positions (all are at the same location). One way to avoid this is to randomly move nodes at least a little bit.
So what exactly is observed when they are at the same location?

from cytoscape.js-cose-bilkent.

aindlq avatar aindlq commented on August 15, 2024

I tried to enable randomized: true, move nodes out of the same point, apply random layout before cose-bilkent, but it has no effect on "cose-bilkent" layout.

see http://jsbin.com/yuremezoma/1/edit?html,output , try to collapse and then expand some compound node

from cytoscape.js-cose-bilkent.

ugurdogrusoz avatar ugurdogrusoz commented on August 15, 2024

Interesting. Why do you apply layout on child content upon expand? Why not just break the parent-child relations upon collapse but keep the child nodes around with their locations and restore them upon expand? Here is an example, where we do exactly that: http://cs.bilkent.edu.tr/~ivis/SBGNViz.js_editor/sample-app/

from cytoscape.js-cose-bilkent.

maxkfranz avatar maxkfranz commented on August 15, 2024

Maybe it's because the layout call is on a collection of nodes with no edges?

from cytoscape.js-cose-bilkent.

aindlq avatar aindlq commented on August 15, 2024

Because user wants to be able to move around collapsed node. In your example when node is expanded it will be moved back to the initial position, but we want to expand it in place.

from cytoscape.js-cose-bilkent.

metincansiper avatar metincansiper commented on August 15, 2024

@aindlq
In SBGNViz we handled the movement of collapsed nodes case in the following way. Before collapsing a compound we save the position of it before the collapse operation. Then when it is being expanded we calculate the difference between its current position and the position just before it is collapsed. Finally, we apply the same movements to the restored nodes.

@maxkfranz
I think that in cose-bilkent we are creating layout nodes to apply CoSE layout on them in top-down approach starting from the orphan nodes. I think that because of the reason that the orphan nodes are not passed to the layout the layout nodes are not created for these nodes. I hope that this problem can be solved if we start from the nodes whose parent do not exist between the nodes passed to the layout, instead of starting from the orphans, returned by cy.orphans().

from cytoscape.js-cose-bilkent.

maxkfranz avatar maxkfranz commented on August 15, 2024

@metincansiper That sounds right. node.parent().intersection( layoutNodes ).empty() is a safer check

from cytoscape.js-cose-bilkent.

metincansiper avatar metincansiper commented on August 15, 2024

I have created a function returning the list of top most nodes in a node list. Then I used this method where I was using nodes.oprhans() previously. The problem seems to be solved now.

from cytoscape.js-cose-bilkent.

ugurdogrusoz avatar ugurdogrusoz commented on August 15, 2024

@aindlq could you please confirm your problem is fixed and close this issue if so?

from cytoscape.js-cose-bilkent.

maxkfranz avatar maxkfranz commented on August 15, 2024

@metincansiper @ugurdogrusoz If this change fixes it, then it can be gulp published as 1.3.1

from cytoscape.js-cose-bilkent.

aindlq avatar aindlq commented on August 15, 2024

Hm, maybe I'm doing something wrong but the only change that I can observe is that compound node is fit to viewport.

see http://jsbin.com/qimecaxose/edit?html,output

@metincansiper Thank you for the suggestion, I really like the way you're doing it. This way layout of nodes inside compound after expand will be the same as before +1

from cytoscape.js-cose-bilkent.

metincansiper avatar metincansiper commented on August 15, 2024

@aindlq Thanks for noticing the bug. I made some corrections and it seems to be working now. I have also tried your fiddle and see that upon expand operation layout is being performed now. However, compound node still fits to viewport in your fiddle if you do not want this, you can specify the fit option of the layout as false. Could you please confirm that your problem is fixed. If it is fixed we can publish 1.3.1.

from cytoscape.js-cose-bilkent.

aindlq avatar aindlq commented on August 15, 2024

@metincansiper thank you! works fine.

from cytoscape.js-cose-bilkent.

metincansiper avatar metincansiper commented on August 15, 2024

@aindlq we realized that while I was fixing this bug I made a logical mistake and something went wrong in version 1.3.1. Then I corrected that mistake and published version 1.3.2. We wanted to inform you about this. You may want to upgrade to cose-bilkent version 1.3.2.

from cytoscape.js-cose-bilkent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.