Skip to content

Graph redraw is very slow #29

@MohammadAlHajj

Description

@MohammadAlHajj

I am using the graph to display ~1k vertexes and ~4k edges. I am having a very hard time making the graph redraw rate manageable. I am using multiple vertex decorators (Coulomb, Hook, Pin Center). I have not yet started adding edge decorators.

The problem is 2-fold. The first one is that the Coulomb Algorithm is O(n^2) complexity. The second is (and i am not sure how this works) that the algorithm is running single threaded. These things should be parallelizable. I don't know if and how they can be offloaded to the GPU/multithreaded. I am currently getting around 2 seconds per redraw per vertex on a Samsung A54. It is also causing the app to crash at this size of graph.

I am currently trying to implement a BarnesHutCoulombDecorator. This algorithm runs in O(nlog(n)) at the cost of negligible accuracy (half a pixel). I will be adding it as a pull request once i get the damn thing to work.

The other issue with parallelism might be implemented with isolates (not sure as i am new to flutter), but I have no way of plugging it in with the decorators that i can see. The decorators seem to work per vertex (GraphAlgorithm.compute(Vertex v, Graph graph) ) and i can't find a way to run the method on the whole graph/batch at once per redraw

Is there anything you can help me with? I don't really know if i am using the tool in the way you designed. My goal is to be able to handle 10K vertexes 50K edges at some point.

Finally, I am bashing my head against the lack of docs. I had to read whole classes to understand what some fields do. I would appreciate it if you can point me to anything that describes the workflow of the graph redraw/recalculation process. I think I get it, but i need some confirmation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions