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

Specify boundingBox #9

Open
maxkfranz opened this issue Feb 29, 2016 · 10 comments
Open

Specify boundingBox #9

maxkfranz opened this issue Feb 29, 2016 · 10 comments

Comments

@maxkfranz
Copy link
Member

Layouts usually have a boundingBox option so that the area in which the layout is run can be specified/constrained. This is useful when running layouts on subsets of the graph, e.g. eles.layout().

It would be nice to have this feature in CoSE Bilkent.

Avoiding overlap with nodes can contradict the bounding box (i.e. the bounding box may not have enough room to prevent node overlap). In that case, it's OK to overflow the bounding box. However, there is usually an option so the dev can decide (i.e. avoidOverlap : on true avoids node overlap and might overflow the bounding box, on false respects the bounding box but nodes might overlap).

@aindlq
Copy link

aindlq commented May 18, 2016

That would be really nice for re-layouting of compound nodes children.

@ugurdogrusoz
Copy link
Contributor

When the following is resolved, this can be implemented using that feature (a virtual compound including everything): #6

@jclif
Copy link

jclif commented Jan 21, 2018

Would this also allow configure my layout to take better advantage of a rectangular container (desktop screen)?

@ugurdogrusoz
Copy link
Contributor

Yes, you could define this "virtual" compound containing everything in the dimensions that you desire. However, notice that you would have to specify dimensions not aspect ratio, and you would need to make sure the dimensions are big enough to accommodate the entire content.

@maxkfranz
Copy link
Member Author

It's usually best to let a layout, like CoSE, just run and figure out how much space it needs. It fits to the screen with scaling (zoom) anyway.

A bounding box is really only useful for particular usecases (usually subgraphs).

@jclif
Copy link

jclif commented Jan 23, 2018

@maxkfranz Ah, you're right. I hitched my bandwagon to an issue that I thought was related to the cola layout. I'm currently using the cose-bilkent layout, which does indeed fit the space, but was hoping to discover whether the cola layout might be capable of achieving a similar result. Speaking from my own personal use case, I find myself wishing that I could constrain the "aspect ratio" of the final positions of the nodes so that there is an efficient usage of visual space for non-square canvases, such as is the case for most desktop (landscape shape) and mobile (portrait shape) devices. I've achieved some semblance of this idea with the cose-bilkent layout, but I would love to use cola instead, as it appears to be superior in many ways.

screen shot 2018-01-23 at 3 53 44 pm

@ugurdogrusoz
Copy link
Contributor

It is actually perfectly reasonable to input aspect ratio of the screen in which the graph is to be displayed to the layout algorithm and get the layout respecting that aspect ratio. An aspect ratio respected by the layout algorithm means the graph objects being analyzed can be displayed larger and become more visible. As I said current cose-bilkent doesn't support this though. I do have ideas on how this could be achieved with cose-bilkent but we just don't have the resources to try it out at the moment.
@jclif Choice of layout algorithm depends on your application. I don't know what your requirements are but usually cola is a good layout if you have constraints (e.g. specifying alignment or respective position constraints) or if you already have a reasonably (manually laid or laid out by another algorithm); performs rather poorly if your graph is unconstrained and don't have initial "draft" layout. cose-bilkent is mainly for compound (nested) drawings.

adhusson added a commit to adhusson/cytoscape.js-cose-bilkent that referenced this issue Feb 18, 2018
@pkovanen
Copy link

I just wanted to check if you have plans to implement bounding box for cose-bilkent?

We have a very specific use case where we have to be able to draw even completely random graphs for 4-20 nodes. Most of the time cose-bilkent works fine, but sometimes it creates graphs that are impossible or very hard to read on a small screen:

image

Adding bounding box functionality would be great as it would ensure the nodes are always big enough and nodes use the screen estate more evenly.

--
Furthermore, I also had the idea that I could first use cose-bilkent and then cola. Unfortunately I couldn't get cola's bounding box functionality working: cytoscape/cytoscape.js-cola#66

From your comment @ugurdogrusoz I got the impression that this might be a viable option?

@ugurdogrusoz
Copy link
Contributor

@pkovanen I didn't mean cola can take an aspect ratio and address your concern. What I meant was perhaps with some constraints you can achieve what you need. I am talking about constraints like such and such nodes must be horizontally aligned, etc.
A viable option now is the new version of cose-bilkent named fcose, which happens to support some type of constraints.

@pkovanen
Copy link

Ok, already had a look at the latest fcose - however since the data we have present is random I'm having hard time using the provided constraints to achieve what I am looking for. My only need is utilizing more of the screen size for the graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants