-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Repeated renderings of edges and O(n²) complexity when rendering multiple Bezier edges #3309
Comments
@YinDongFang would you repost your jsbin demo? The link isn't working for me. |
Thanks, @YinDongFang. That's giving a 404. Is it public? In the meanwhile, I'll note this: There are several things that can invalidate a bundled group of beziers. When one edge in the bundle is changed (e.g. style), the others may also need to be updated. One example is when one of the edges in the bundle is moved out of the bundle by changing the edge type from bundled bezier to something else (like unbundled bezier). In this example, changing one edge changes all the other edges in the bundle, because the bundle size has changed -- and so it needs to be rebalanced. At first glance, it looks like your PR takes into account the case where one or more of the source and target node move. Would your changes still allow for changes in style, like the example I gave, to invalidate the cached style data (e.g. points)? |
In my project, I only use Bezier curves, so I haven't tested other cases. I will modify the code. Also, your example helped me discover another bug, which I will fix as well. If there are any other scenarios or cases that need to be considered, please let me know. Thank you! Minimum steps to reproducehttps://ivis-at-bilkent.github.io/cytoscape.js-fcose/demo/demo-constraint.html
Current (buggy) behaviourThe other edge between |
New commit 2add561 fixed this bug. In function |
I don't know how to make JSBin link permanent, try this CodeSandbox https://4jm8zw.csb.app/ |
This is expected behaviour. In your example, moving out one edge from the two-edge bundle should make the remaining edge straight. A bundle of odd size has one of the edges as straight to keep things balanced. It also makes it so that bezier edges work well out-of-the-box for multiple use cases, e.g. multigraphs (where edges naturally should be bundled) and simple graphs (where you expect the single edge to be straight). |
I'll take a look at the demo on CodeSandbox |
2025-01-09.194231.mp4The buggy behaviour is the curve is flickering when drag node |
@YinDongFang, I don't see anything new in your Code Sandbox demo. It just shows the base images demo without any changes. |
Let's handle one thing per issue. The parallel edge bug is specified in: |
I have a much simpler patch that addresses the issue. It can be merged in some time over the next week or so, in conjunction with other patches. |
@maxkfranz Hi, is there any new progress regarding this performance issue? |
@YinDongFang, try the latest code on the unstable branch |
Since the latest code doesn't exhibit this behaviour for me, I'm closing this for now. It can be reopened if it becomes an issue in future. |
Environment info
Current (buggy) behaviour
Desired behaviour
Minimum steps to reproduce
https://output.jsbin.com/puyafes
Reason
For repeated rendering: The
BRp.registerCalculationListeners
has alreadyrecalculateRenderedStyle
for all nodes and edges to update, but without update ofbbCachePosKey
. So in render function,recalculateRenderedStyle
execute again withuseCache = false
.For O(n^2) when rendering multiple Bezier edges: in render function,
recalculateRenderedStyle
execute for single node or edge, but inrecalculateEdgeProjections
, it will loop all parellel bezier edges without cache. When updating 100 edges, it will executefindBezierPoints
100*100 times.For reviewers
Reviewers should ensure that the following tasks are carried out for incorporated issues:
master
,unstable
, and1.1.x
if the current release is 1.2).bug
, if necessary.The text was updated successfully, but these errors were encountered: