G6 icon indicating copy to clipboard operation
G6 copied to clipboard

Large Graph Example - Find Neighbors Functionality Not Working

Open mzhukovs opened this issue 2 years ago • 1 comments

Describe the bug

Thank you for this great library and excellent example: https://g6.antv.vision/en/examples/case/graphDemos#largeGraph

In that Large Graph Example though, if you right click on a real (non-aggregated node) and select "Find N-degree Neighbors" from the context menu - it will add a bunch of new nodes to the graph with "undefined" labels. Does not seem to be working correctly.

P.S. is there another example, or a recommended way to update this current example, to handle the case of multiple levels of clustered groups? For example, a top-level cluster could contain a few sub-clusters, and each of those may contain either the "real nodes" or even more child clusters of their own). Please let me know, would be much appreciated.

Your Example Website or App

https://g6.antv.vision/en/examples/case/graphDemos#largeGraph

Steps to Reproduce the Bug or Issue

if you view that Example and right click on a real (non-aggregated node) and select "Find N-degree Neighbors" - it will add a bunch of new nodes to the graph with "undefined" labels.

Expected behavior

It would highlight in some way the first/second/third degree neighbors to the current node that the context menu option was used on.

Screenshots or Videos

No response

Platform

Windows 11 MS Edge latest

Additional context

No response

mzhukovs avatar Sep 11 '22 21:09 mzhukovs

The label with undefined-xxx is generate by G6.Util.uniqueId() which is defined as

export const uniqueId = (type: string): string => {
  return `${type}-${Math.random()}${Date.now()}`;
};

So the undefined comes from the undefined param type. In the large graph example, the type is missed when calling uniqueId, I will update the code ASAP.

P.S. is there another example, or a recommended way to update this current example, to handle the case of multiple levels of clustered groups? For example, a top-level cluster could contain a few sub-clusters, and each of those may contain either the "real nodes" or even more child clusters of their own).

I think it just some different implementation for the function generateNeighbors in the large graph demo

Yanyan-Wang avatar Sep 19 '22 03:09 Yanyan-Wang

This issue has been solved?

abreumorais avatar Oct 21 '22 16:10 abreumorais

This issue has been solved?

Yes

Yanyan-Wang avatar Nov 04 '22 08:11 Yanyan-Wang

This issue has been solved?

Yes

I have the same problem. What shoud I do to show the label nodes of the N-degree neighbors?

abreumorais avatar Nov 04 '22 14:11 abreumorais