Skip to content
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

Large graphs: Faster graph object creation #275

Open
shadiakiki1986 opened this issue Sep 23, 2021 · 3 comments
Open

Large graphs: Faster graph object creation #275

shadiakiki1986 opened this issue Sep 23, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@shadiakiki1986
Copy link

shadiakiki1986 commented Sep 23, 2021

Problem

  • I would like it if large graphs (eg 5k nodes, 30k edges) loaded faster than 2 minutes

The slowest part for me is the edge creation. The Edge() constructor is called n-edge times at cytoscape.py#L524. It's not the Edge constructor that's slow, but the Widget constructor from which Edge inherits.

Proposed Solution

I already started a SO question asking about the most efficient way to create a large number of Widget objects here.
It seems to me that the solution would require a new EdgeList class that internally handles a list of edges and just needs a single Widget constructor call, but I don't know the internals, so this might as well be non-sense.

Btw, the same applies to the Node constructor, but it's a smaller problem for me ATM

@shadiakiki1986 shadiakiki1986 added the enhancement New feature or request label Sep 23, 2021
@marimeireles
Copy link
Collaborator

Thanks for opening the issue!

It seems to me that the solution would require a new EdgeList class that internally handles a list of edges and just needs a single Widget constructor call, but I don't know the internals, so this might as well be non-sense.

This makes sense to me, it seems like it'd work... I'm just worried with the synchronization problems that spectate have with deep objs.

@MridulS implemented most of these methods :) You have an opinion on this?

@MridulS
Copy link
Contributor

MridulS commented Sep 30, 2021

It seems to me that the solution would require a new EdgeList class that internally handles a list of edges and just needs a single Widget constructor call, but I don't know the internals, so this might as well be non-sense.

This makes sense to me, it seems like it'd work... I'm just worried with the synchronization problems that spectate have with deep objs.

This should be possible but I think this will take up some initial effort to implement the EdgeList class and keep the syncing, like this will probably mean that once the graph is created you can't delete any edge manually from that EdgeList (or recreate the EdgeList class with N - 1 edges) which (IMO) kind of breaks functionality as it's nice to have an interactive graph where you can remove and add nodes/edges as required.
It's possible there's a better solution, I am not an expert in jupyter widgets :)

@marimeireles
Copy link
Collaborator

Yes, that would be terrible. But (I just look at the code)...

edges = MutableList(Instance(Edge)).tag(sync=True, **widget_serialization)

Theoretically, the interactivity should be preserved because edges is a MutableObject already.
So, I'd say this idea sounds good. :)
If you're willing to tackle it, please go ahead, I'm around here and on the https://gitter.im/QuantStack/Lobby channel if you have any doubts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants