Closed DaniilRyb closed 2 months ago
It looks like you may have a good start to specifying your issue. Two points:
(1) Issues for cytoscape-reactjs
should go to that repo, and the folks at Plotly will address it accordingly: https://github.com/plotly/react-cytoscapejs
(2) To expedite your issue, it would be best for you to have a reproducible demo. Codepen allows for demos that require build steps.
Thanks for the answer, will be trying your advices. Codepen is a good idea, but simulation in Codepen may be different than in Browsers (Firefox, Chrome and etc.) But it's worth a try P. S. I managed to run the project with the "randomize" parameter: false, but when the page is reloaded, the graph still looks different. Then the question arises, is the graph idempotent in principle? (always the same, even the position of the vertices is exactly in the position they were in before)
@maxkfranz: I have the same problem (without react): when there are a lot of nodes in the same spot (x:0, y:0) and randomize is false, then the browser freezes during the euler layout. You can see this with the current version of SNIK Graph ( 24.06, commit date 2024-06-18T15:51:11+02:00, release 24.06) at https://www.snik.eu/graph/ when you press CTRL+ALT+R (restores all hidden nodes which are at position 0,0) and then CTRL+ALT+T ("tight layout", or click on the tight layout button), then it often freezes.
I can work around the problem by giving all nodes some other position but this takes way too long (the web app loads in 2 seconds instead of 1 second).
This layout is fairly basic as far as force-directed layouts go.
The purpose of randomise:false is to provide your own initial positions. If you leave everything at (0,0), you haven't specified any positions. The way a FD layout would typically handle inputs of nodes with identical initial positions would be either:
(1) Throw an error (i.e. because of user error), e.g. IdenticalPositionsForbiddenError
(2) Randomise the overlapping positions
You can do (2) yourself by using randomize:true
.
In general, I'd recommend using FCOSE (faster, better) instead of this layout unless you have a very strong justification for not using FCOSE.
The reason for not using FCOSE is that we created our application in 2016 when it didn't exist, so I will switch to it and see if it fits our use cases the same way :-) @maxkfranz: After testing FCOSE in place of Euler, I noticed that FCOSE is much slower (more than a minute) and causes a Stop/Debug message to appear on Firefox on a Laptop with an Intel i3-1115g4 CPU.
Euler on the other hand only takes a few seconds. The graph has 4085 nodes and 8198 edges.
Hello! I found problem of infinite render page (or graph i don't know what exactly) Bug: infinite render (Chrome Version 116.0.5845.187 (Official Build) (arm64))
Basic dependencies for convenience: "cytoscape": "^3.0.0", "react-cytoscapejs": "^2.0.0", "cytoscape-euler": "^1.2.2",
The main problem is in the CytoscapeСomponent (all code of the Graph component on React) and in the layouts object, namely the property "randomize": false.
One of the main reasons, it seems to me, is the following:
With randomize: true, all works good just in case, I attach the entire component code
Source code: