Code Monkey home page Code Monkey logo

Comments (4)

dunnock avatar dunnock commented on August 23, 2024

Most likely all the extra time is spent building the quadtree index in SigmaJS: https://github.com/jacomyal/sigma.js/blob/9c940aa9b162c7aaaf8b25d88e236cb847c1633a/src/sigma.core.js#L548

For instance, if you are using curve or curvedArrow edges that takes extra time to calculate shape: https://github.com/jacomyal/sigma.js/blob/31cc1ee3baf321d355f5597ba4d7e9fc8e2c6ff2/src/classes/sigma.classes.edgequad.js#L711

Did you check profiler? It should show what consumes most of the time. Also check if you got enough of free RAM.

from react-sigma.

bt2414 avatar bt2414 commented on August 23, 2024

Thanks for your replay.
I also tried curvedArrow but it doesn't affect the performance. Could you take a look at my code?


        <Sigma
          style={{width:"100%", height:"720px", backgroundColor:"#19193b"}}
          renderer="canvas"
          graph={this.state.bigGraph}
          settings={{
            drawEdges: true,
            drawLabels: true,
            drawEdgeLabels: false,
            labelThreshold: 0,
            enableEdgeHovering:true,
            edgeHoverExtremities: true,
            defaultLabelColor:"#dddddd",
          }}
        >
          <EdgeShapes default="curvedArrow" />
          <ForceLink
            worker={true}
            barnesHutOptimize={false}
            slowDown={5}
            gravity={1}
            timeout={10000}
          />
          <RandomizeNodePositions />
          <RelativeSize initialSize={15} />
        </Sigma>

If I remove the "enableEdgeHovering:true", it works good without any delays even if I set the "curvedArrow".

Do you think it is normal? Why "enableEdgeHovering" doesn't have the same performance with "EdgeSphapes"?

Thanks so much.

from react-sigma.

bt2414 avatar bt2414 commented on August 23, 2024

I think you are right, it is the building of the quadtree index consumes time. I try to remove this piece of code, it works good.

        if (
          c.edgequadtree !== undefined &&
          c.settings('drawEdges') &&
          c.settings('enableEdgeHovering')
        ) {
          c.edgequadtree.index(this.graph, {
            prefix: c.readPrefix,
            bounds: {
              x: bounds.minX,
              y: bounds.minY,
              width: bounds.maxX - bounds.minX,
              height: bounds.maxY - bounds.minY
            }
          });
        }

But do you think 3 seconds delay is normal?

from react-sigma.

dunnock avatar dunnock commented on August 23, 2024

If you set edge shapes to line it should work faster, curved and curvedArrow are slower because it calculates curve edges.

<EdgeShapes default="line"/>

https://github.com/dunnock/react-sigma/blob/master/DOCS.md#edgeshapes

from react-sigma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.