jaal icon indicating copy to clipboard operation
jaal copied to clipboard

Can't display a big graph

Open vherrera96 opened this issue 3 years ago • 3 comments

Hello! Thanks for this wonderful package! I've been playing with random graphs and it works great. However after trying to display a "big graph" (44 nodes and ~300 edges) something weird happens. It seems unable to stabilize the graph and it doesn't stop moving. Do you know how to fix this? Thank you! ezgif com-gif-maker (1)

vherrera96 avatar Sep 01 '21 15:09 vherrera96

Hi @vherrera96, this behavior is observed when the physics stabilization engine is not able to converge (which is quite tough for skewed graphs with a high edge to node ratio). One way we can "force" convergence, is by reducing the steps taken for stabilization. Sample code (taken from readme example),

# init Jaal and run server
Jaal(edge_df, node_df).plot(vis_opts={'physics':{'stabilization':{'iterations': 100}}}) # define the convergence iteration of network

Here, you can try reducing the iterations value which will halt the stabilization effort. I should point out that while your graph will stop moving, it might be quite "messy" to see 😅

imohitmayank avatar Sep 02 '21 04:09 imohitmayank

Maybe allow some manual intervention by letting the user to choose node(s) and "fix them in place" (to slightly clean the "mess" you write about)?

dumblob avatar Sep 08 '21 07:09 dumblob

For me the stabilization key word did not help but to change the solver helped. I got best results with repulsion instead of the default BarnesHut:

Jaal(edge_df, node_df).plot(directed=True, vis_opts={'physics':{'solver' : 'repulsion'}})

Using `` the most important settings were centralGravity (increased from 0.3 to 1.0 ) and springConstant (reduced from 0.04 to 0.01):

Jaal(edge_df, node_df).plot(directed=True, vis_opts={'physics': {'stabilization': False, 'barnesHut': {'centralGravity': 1, 'springConstant': 0.01}}})

You can turn stabilizationoff or keep it on (and adjust iterations to your liking).

Famondir avatar Nov 07 '23 14:11 Famondir