Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of uppercase, lowercase, numbers, and special characters (such as @*&#).
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

v4.2
Search
中文EN
v4.2

    K-Hop

    Statement khop().src().depth() can find and return neighbor nodes that a node can reach in K hops/steps the shortest, by specifying depth (number of edges), applying filters on the nodes and edges.

    K-Hop is a basic concept in graph theory, when the filtering conditions on nodes and edges are specified, the k-index of a node regarding to the subject node is either unique or non-existent. Ultipa implements K-Hop query using BFS (Breadth First Search) algorithm to guarantee the paths to reach the neighbors are the shortest.

    (Yellow, green and blue nodes are the 1hop, 2hop and 3hop neighbors of the red node in the center)

    K-Hop is a graph neighbor query function with an optimized and greatly improved performance, it is suggested to use K-Hop instead of other path query methods when querying neighbor nodes.

    Syntax:

    • Statement alias supported (NODE type)
    Parameter Type Specification Description Structure Type of Custom Alias
    src() Filter Mandatory The filtering rules of the start node; error will occur if multiple nodes are found NODE
    depth() Range Mandatory To set the depth of the path:
    depth(N): N edges
    depth(:N): 1~N edges
    depth(M:N): M~N edges
    Not supported
    node_filter() Filter The filtering rules that neighbor nodes other than the src need to satisfy Not supported
    edge_filter() Filter The filtering rules that all edges need to satisfy Not supported
    direction() String left, right To specify the direction of the edges Not supported
    limit() Int -1 or >=0 Number of results to return in single execution, -1 means to return all results Not supported

    N Hops

    Example: find 10 Card CA001's 3-Hop neighbors, return all node properties

    khop().src({_id == "CA001"}).depth(3) as n
    limit 10 
    return n{*}
    

    1~N Hops

    Example: find 10 Card CA001's neighbors within 3 hops, return all node properties

    khop().src({_id == "CA001"}).depth(:3) as n
    limit 10 
    return n{*}
    

    M~N Hops

    Example: find 10 Card CA001's neighbors within 2~3 hops, return all node properties

    khop().src({_id == "CA001"}).depth(2:3) as n
    limit 10 
    return n{*}
    

    node_filter()

    Example: find 10 Card CA001's neighbors within 3 hops, return all non-@card node properties

    khop().src({_id == "CA001"}).depth(:3)
      .node_filter({!@card}) as n
    limit 10 
    return n{*}
    

    edge_filter()

    Example: find 10 Card CA001's neighbors within 3 hops, return all non-@transfer edge properties

    khop().src({_id == "CA001"}).depth(:3)
      .edge_filter({!@transfer}) as n
    limit 10 
    return n{*}
    

    direction(right)

    Example: find Card CA001's neighbors within 3 hops, return 10 nodes that are connected by edges in the right direction (outbound) and their properties

    khop().src({_id == "CA001"}).depth(:3)
      .direction(right) as n
    limit 10 
    return n{*}
    

    direction(left)

    Example: find Card CA001's neighbors within 3 hops, return 10 nodes that are connected by edges in the left direction (inbound) and their properties

    khop().src({_id == "CA001"}).depth(:3)
      .direction(left) as n
    limit 10 
    return n{*}
    

    limit

    Example: find Card CA001 and Card CA002's neighbors within 3 hops, return 3 neighbors' properties for each node

    uncollect ["CA001","CA002"] as n1
    khop().src({_id == n1}).depth(3)
      .limit(3) as n2
    return n2{*}
    
    Please complete the following information to download this book
    *
    公司名称不能为空
    *
    公司邮箱必须填写
    *
    你的名字必须填写
    *
    你的电话必须填写
    *
    你的电话必须填写