cytoscape / cytoscape.js-dagre

The Dagre layout for DAGs and trees for Cytoscape.js
MIT License
249 stars 83 forks source link

Dagre control points for drawing more accurate edges #5

Closed danielpes closed 4 years ago

danielpes commented 8 years ago

It would be nice if thie cytoscape-dagre layout could make the edges "points" attribute available for the cytoscape graphs, giving the possibility to draw more accurate edges with segments or unbundled-bezier styles.

mafar commented 8 years ago

see cytoscape.js (cytoscape-dagre) vs dagre-d3.js for same set of data.

How can I make cytoscape.js edges same like dagre ? Any help will be much appreciated.

cytoscape-dagre should be able to pick points from dagre !!! see from example https://jsfiddle.net/bababalcksheep/55cmk117/6/ where after dagre.layout(g); dagre has points in edges data which could be consumed by cytoscape segment edges.

maxkfranz commented 8 years ago

Not easy to do until 2.7 is released with style properties for configuring where the segment-weights start and end: https://github.com/cytoscape/cytoscape.js/issues/1236

mafar commented 8 years ago

@maxkfranz 2.7 is released. Waiting for this feature. Thankx

maxkfranz commented 8 years ago

@djangosdk There are a lot of other tasks for Cytoscape.js that have to take priority. If this feature is important to you, we'll gladly accept a pull request. It should be straightforward to implement in 2.7. The segments property values should go in user specified node.data() fields so the user can map to them in their stylesheet.

mafar commented 7 years ago

@maxkfranz Can you still help with some basic example or point me in right direction. I am in dire need for Dagre control points for Cy. A description of what to do , where to do will also help ( I did not understand fully how to utilize segments property values ) I updated all examples above and they are working now i https://github.com/cytoscape/cytoscape.js-dagre/issues/5#issuecomment-210742510

newlukai commented 7 years ago

I spent some time trying to convert Dagre's control points to Cytoscape's segment edges (distances and weights). Unfortunately, the rendered result is not that beautiful, but maybe it's a start to get this issue done?

Some edges aren't rendered and appear spontaneously when moving a connected node. Additionally the edges don't follow the points of Dagre's layout.

A first version of implementing this issue.

knownact commented 6 years ago

@newlukai I have improved your implementation, make it more beautiful. please check it out.

3bef946c348d419366c8b75b0bd3a2ee3ac28e34

knownact commented 6 years ago

and fix when rankDir is "LR":

af46725944e8d294179fe6f5d344679f7d025694

yansenlei commented 6 years ago

@knownact Is it like this?http://jsfiddle.net/5u9mzfse/47/

knownact commented 6 years ago

Now, the result is like this: image

knownact commented 6 years ago

By the way , I think default result is good.

https://jsfiddle.net/knownact/usL3ayxn/3/

yansenlei commented 6 years ago

@knownact If it is drawing a flow chart, Klay shows better. dagre: image

klay: image

knownact commented 6 years ago

@yansenlei yep, but can you give me the test data? i think dagre is not bad like this:

image

yansenlei commented 6 years ago

@knownact sure, like this: https://jsfiddle.net/leiys/e2rc66b8/3/

knownact commented 6 years ago

this is what I get:

image

yansenlei commented 6 years ago

yes, this layout is not like a flowchart.

knownact commented 6 years ago

yep, Klay is better!

newlukai commented 6 years ago

Since I was in the need to find a solution, I switched to mxGraph. It's not as light-weight as cytoscape, but the provided layouts do fine and I'm now able to make very specific changes to the graph.

@knownact : Your changes look good.

Regarding the discussion started shortly: Yes, Klay is better.

mafar commented 6 years ago

can we get this feature ? Been three years now

maxkfranz commented 6 years ago

You're right. It's been about three years. But it's been three years of significant updates to the main library and also to first-party extensions -- all of which the community can freely re-use. The Cytoscape Consortium has to prioritise, and in that prioritisation community feedback is carefully taken into account.

In the spirit of open-source, we welcome pull requests from the community for features like this.

Thanks for your feedback.

maxkfranz commented 5 years ago

Dagre can only inform where the edges should be routed for the node positions that Dagre specifies. As soon as the nodes are moved, Dagre's assumptions are no longer true and the use of Dagre's edge points would give bad results.

For trees -- and probably some types of DAGs as well -- specifying the points from Dagre itself isn't really needed in cytoscape>=3.5. The curve-style:taxi edge style allows for automatic routing of an edge using taxicab geometry. This gives a very similar result as Dagre's edge points, except the native Cytoscape taxi feature works interactively whereas Dagre does not.

See https://github.com/cytoscape/cytoscape.js/issues/2306. The example graph in that issue uses a Dagre layout with taxi edges.

maxkfranz commented 5 years ago

The example graph: screen shot 2019-02-19 at 5 12 38 pm

stale[bot] commented 5 years ago

This issue has been automatically marked as stale, because it has not had activity within the past 30 days. It will be closed if no further activity occurs within the next 30 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

deepanshu11madan commented 4 years ago

was anyone able to make the this work? I am facing the similar issue, why doesn't cytoscape.js-dagre follow the dagre layout for edges?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale, because it has not had activity within the past 30 days. It will be closed if no further activity occurs within the next 30 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

deepanshu11madan commented 4 years ago

Is there any future plan to make edges follow dagre layout?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale, because it has not had activity within the past 30 days. It will be closed if no further activity occurs within the next 30 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

koo5 commented 3 years ago

hello stale bot, did microsoft send you to break opensource? It's not hard to see how changing the meaning of "closed" is perfectly counterproductive, is it?

knightswatch3 commented 3 years ago

I do not understand what the solution to overlapping paths is. Has this been addressed in any of the cytoscape versions ?

rish1 commented 1 year ago

this is what I get:

image

How did u manage to draw an edge saperately in my case difference edges shares one i mean it merges down at some point

danyel-motif commented 1 year ago

Hey, @knownact -- I just wanted to thank you for the hard work you did on https://github.com/cytoscape/cytoscape.js-dagre/issues/5#issuecomment-373244016

It's lovely for my purposes. (And @maxkfranz , thanks for the library!)