K-hop
Overview
K-hop is an algorithm used to search all nodes in the k layer that are associated with the source node through breadth-first search (BFS). The found sub-graph is the source node's ego-net. The K-hop algorithm returns the number of nodes in the ego-net.
Application Scenarios
This algorithm applies to scenarios such as relationship discovery, influence prediction, and friend recommendation.
Parameter Description
Parameter |
Mandatory |
Description |
Type |
Value Range |
Default Value |
---|---|---|---|---|---|
k |
Yes |
Number of hops |
Integer |
1-100 |
- |
source |
Yes |
Node ID |
String |
- |
- |
mode |
No |
Direction:
|
String |
OUT, IN, ALL |
OUT |
Precautions
- A larger k value indicates a wider node coverage area.
- According to the six degrees of separation theory, all people in social networks will be covered after six hops.
- BFS searches information based on edges.
Example
Select the algorithm in the algorithm area of the graph engine editor. For details, see Analyzing Graphs Using Algorithms.
Calculate the sub-graph formed by the three hops starting from the Lee node.
Set parameters k to 3, source to Lee, and mode to OUT. The sub-graph is displayed on the canvas, and the JSON result is displayed in the query result area.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.