-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Making getNodesInCluster() recursive #3881
base: develop
Are you sure you want to change the base?
Making getNodesInCluster() recursive #3881
Conversation
Hi, thanks for your contribution. Would you please add some word on why a recursive implementation is better for this use case? Have you tested your code and the previous implementation with respect to time and space complexity? |
lib/network/modules/Clustering.js
Outdated
* @returns {Array.<Node.id>} | ||
*/ | ||
getNodesInCluster(clusterId) { | ||
getNodesInCluster(clusterId, recursive = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adapting the documentation here [1]? Is there any benefit of making the actual algorithm implementation configurable? Is this something the user might care?
[1] http://visjs.org/docs/network/index.html?keywords=getNodesInCluster
lib/network/modules/Clustering.js
Outdated
@@ -850,15 +850,25 @@ class ClusterEngine { | |||
/** | |||
* | |||
* @param {Cluster.id} clusterId | |||
* @param {Recursive} recursive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be boolean
instead of {Recursive}
? I would expect something like @param {boolean} [recursive=false]
Correct me if I'm wrong.
Hi @Tooa , I will make the changes requested asap. Currently I am working on what I consider to be a medium-size level-clustered network: It starts with 3 clustered that contains another clustered nodes that contains another clustered nodes ...... until it opens the "leaf" nodes. The recursive method comes in hand when the user clicks a clustered node that contains another clustered node. In my case, when this interaction is made, I would like to get all the leaf nodes the clicked clustered node contains. The current implementation is only returning me the clustered nodes inside the clicked clustered node. I'm not sure if I understood right your questions, if there's any doubt left please feel free to ask! Regards, Edit: Ah! Please note that when the |
@Menighin thanks for the sending this PR with the fix! Curious, could you provide a new example that we can use to verify the fix, or point us to an existing example that shows the bug behavior? https://github.com/almende/vis/tree/master/examples/network said another way, could you provide steps to test this PR? |
No description provided.