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

Hierarchical Layout with large clusters still creates gaps after v6.4.5 #276

Open
Tyler-Maclachlan opened this issue Nov 29, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@Tyler-Maclachlan
Copy link
Contributor

Hi Guys,

Thanks for #270, it works really well on small to medium graphs, however it does not fix #264, in fact it seems slower than before and still creates big gaps in the network.

Still using the same dataset as in #264

@Thomaash Thomaash added the bug Something isn't working label Nov 29, 2019
@Thomaash
Copy link
Member

Hi @Tyler-Maclachlan,

could you provide an MWE for this? Because in my tests it works perfectly.

Regarding performance sure it's slower, it does more work. I'm definitely not the best programmer in the world so it most likely could be improved. PRs and suggestions are always welcome.

@Tyler-Maclachlan
Copy link
Contributor Author

Tyler-Maclachlan commented Nov 29, 2019

Hi @Thomaash,

Here is a codepen with the dataset and options that I'm using.

As you can see, pretty much the same result as before, except it now takes longer to get there. I'm not questioning how good a programmer you are, you know more about how to fix this than I do xD

@Thomaash
Copy link
Member

So I investigated this a bit and at least I found out why you have so huge holes in the network. The nodes are positioned when the network is created and then when the clusterByHubSize method is called a lot of nodes disappear but there is nothing to move the nonclustered nodes into the empty space. With default configuration physics would do it but you disabled it. There are three ways how you can solve this:

  • Handle repositioning of the nodes manually.
  • Enable physics to reposition the nodes automatically in real time with fancy animations.
  • Call network.stabilize() manually to reposition the nodes instantly without any kind of animation.

The slow down is impossible not to notice when updating but I can't figure out why it happened. It even happens when the levels are forced (as in you Codepen). The changed layouting code is not invoked at all in such case.

@Thomaash
Copy link
Member

So the culprit is _condenseHierarchy method. Removing it took the time down to less than a second from almost 60 seconds. The purpose of this method is to reduce the amount of space between nodes on the same level which I guess is pretty tricky thing to do (the method has 370 lines) but I didn't look into it yet.

I'm still not sure why it slowed down though. Nobody touched this thing in the past two years.

@Tyler-Maclachlan
Copy link
Contributor Author

Tyler-Maclachlan commented Dec 2, 2019

Hi @Thomaash

Thanks for the help, just a quick question:

If I have all the layouts disabled by default, start the network and do the clusterByHubsize and then enable the layout, that should work for this, but it doesn't seem to change anything?

Calling network.stabilize() seems to ignore the fact that the hierarchical layout is enabled and stabilises to the physics configuration even if physics is disabled.

I have physics disabled because it seems to make the network bounce around with some of the interaction options I use. (Changing node size on hover, showing full node label on hover, showing edge labels on hover)

@Thomaash
Copy link
Member

Thomaash commented Dec 2, 2019

Hi @Tyler-Maclachlan,

if you have such issues maybe it would be a good idea to open a new issue, provide an MWE and see if it's a bug in the library that should be fixed. I don't think that what you describe should cause the network to bounce though I'm not sure what exactly to bounce refers to.

@Tyler-Maclachlan
Copy link
Contributor Author

Tyler-Maclachlan commented Dec 4, 2019

Hi @Thomaash

The bounce is basically when I hover over an edge or node, all the nodes and edges move around erratically. It looks like they're bouncing around.

network.stabilize() and having physics enabled are not viable solutions here.

Why would the fix not work for a pre-clustered network and then enabling the hierarchical layout?

I've updated the codepen with a timeout that enables the hierarchical layout after 5 seconds. This shows that the network is clustered before the layout runs, however it still leaves the gaps.

@Tyler-Maclachlan
Copy link
Contributor Author

Hi @Thomaash,

Have you managed to have a look at the new codepen? Or anything more on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants