Comments (15)
@metincansiper Any idea why this would be happening? Thanks!
from cytoscape.js-cose-bilkent.
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.
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.
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.
Maybe it's because the layout call is on a collection of nodes with no edges?
from cytoscape.js-cose-bilkent.
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.
@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.
@metincansiper That sounds right. node.parent().intersection( layoutNodes ).empty()
is a safer check
from cytoscape.js-cose-bilkent.
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.
@aindlq could you please confirm your problem is fixed and close this issue if so?
from cytoscape.js-cose-bilkent.
@metincansiper @ugurdogrusoz If this change fixes it, then it can be gulp publish
ed as 1.3.1
from cytoscape.js-cose-bilkent.
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.
@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.
@metincansiper thank you! works fine.
from cytoscape.js-cose-bilkent.
@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)
- Graph nodes not laid out properly HOT 4
- Can a point have two parent nodes?
- Uncaught TypeError: ani.play is not a function HOT 3
- how to set node size from data? HOT 3
- "ReferenceError: self is not defined" error occurring in unstable branch HOT 2
- Uncaught TypeError: Cannot read property 'getParent' of undefined HOT 9
- Cytoscape 3.3 objects in Vue.js state cause endless recursion HOT 12
- Possible to create a planar graph? HOT 5
- Is there a way to keep the nodes on a single Y axis? HOT 1
- Multiple groups of nodes are distributed HOT 3
- Setting nodeDimensionsIncludeLabels to true works not well for zero degree nodes HOT 4
- v4.1.0 has breaking changes to v4.0 HOT 4
- Uniform node dimensions HOT 1
- Pack disconnected graph components using new utility
- Incremental tiling
- Seed for deterministic layout HOT 4
- Retain node positions when chart is being re-generated with the same dataset HOT 3
- Tree reduction during incremental layout
- Update License HOT 2
- fit not working with huge amount of data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cytoscape.js-cose-bilkent.