修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

搜索
    中文

      AB路径

      概述

      ab().src().dest().depth()子句查询一个起点和一个终点之间规定长度的全部或部分路径,支持过滤路径中的点和边、剔除带环路的结果、限制查询的结果数量等。

      语法

      • 子句别名:支持,数据类型结构为PATH
      • 命令:ab()
      • 参数:
      参数
      类型 规范
      必须携带
      描述
      参数别名
      src() filter / 路径起点的过滤条件;只能指定一个点,多个点满足条件时会报错 支持,数据类型为NODE
      dest() filter / 路径终点的过滤条件;只能指定一个点,多个点满足条件时会报错 支持,数据类型为NODE
      depth() range >0 路径长度填写格式:
      depth(N):N步
      depth(:N):1~N步
      depth(M:N):M~N步

      如果使用了shortest()参数,路径长度只能设置为固定值,即depth(N).shortest(<?>),表示N步内(加权)最短路径
      不支持
      shortest() 留空,或@<schema>.<property> 留空,或数值类型的边属性(需LTE) 不指定边属性时,查询N步内最短路径

      指定边属性时,查询N步内所有边属于指定schema且指定属性值的和最小的路径,此时depth()参数需填写固定值
      不支持
      node_filter() filter / 中介点(非srcdest)的过滤条件 不支持
      edge_filter() filter / 所有边的过滤条件 不支持
      path_ascend() @<schema>.<property> 数值或时间类型的边属性(需LTE) 查找边属于指定schema且指定属性的值按步递增的路径 不支持
      path_descend() @<schema>.<property> 数值或时间类型的边属性(需LTE) 查找边属于指定schema且指定属性的值按步递减的路径 不支持
      direction() string leftright 路径中所有边的方向 不支持
      no_circle() / / 剔除含有环路的路径;有关嬴图中环路的定义,可参考术语解释 不支持
      limit() int ≥-1 子句每次执行时返回的结果数量,-1表示返回所有 不支持

      示例

      示例图集

      在一个空图集中,依次运行以下各行语句创建示例图集:

      create().edge_property(@default, "weight", int32)
      insert().into(@default).nodes([{_id:"A", _uuid:1}, {_id:"B", _uuid:2}, {_id:"C", _uuid:3}, {_id:"D", _uuid:4}, {_id:"E", _uuid:5}, {_id:"F", _uuid:6}])
      insert().into(@default).edges([{_uuid:1, _from_uuid:1, _to_uuid:3, weight:1}, {_uuid:2, _from_uuid:5, _to_uuid:2 , weight:1}, {_uuid:3, _from_uuid:1, _to_uuid:5 , weight:4}, {_uuid:4, _from_uuid:4, _to_uuid:3 , weight:2}, {_uuid:5, _from_uuid:5, _to_uuid:4 , weight:3}, {_uuid:6, _from_uuid:2, _to_uuid:1 , weight:2}, {_uuid:7, _from_uuid:6, _to_uuid:1 , weight:4}])
      

      规定路径长度

      本例查找从A到E的3步路径,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(3) as p
      return p{*}
      

      A --1--> C <--4-- D <--5-- E
      

      本例查找从A到E的1~3步路径,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(:3) as p
      return p{*}
      

      A --3--> E
      A --1--> C <--4-- D <--5-- E
      A <--6-- B <--2-- E
      

      本例查找从A到E的2~3步路径,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(2:3) as p
      return p{*}
      

      A --1--> C <--4-- D <--5-- E
      A <--6-- B <-2-- E
      

      无权重最短路径

      本例查找从A到E的3步内最短路径,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(3).shortest() as p
      return p{*}
      

      A --3--> E
      

      加权最短路径

      本例查找从A到E的3步内的加权最短路径,要求只经过@default边且边上的weight属性值和最小,返回路径中点和边的全部信息:

      ab()
        .src({_id == "A"})
        .dest({_id == "E"})
        .depth(3)
        .shortest(@default.weight) as p
      return p{*}
      

      A <--6-- B <--2-- E
      

      边属性@default.weight需LTE。

      过滤中介点

      本例查找从A到E的1~3步路径,要求不经过点D,返回路径中点和边的全部信息:

      ab()
        .src({_id == "A"})
        .dest({_id == "E"})
        .depth(:3)
        .node_filter({_id != "D"}) as p
      return p{*}
      

      A --3--> E
      A <--6-- B <--2-- E
      

      过滤边

      本例查找从A到E的1~3步路径,要求路径中的边必须有weight属性且值大于1,返回路径中点和边的全部信息:

      ab()
        .src({_id == "A"})
        .dest({_id == "E"})
        .depth(:3)
        .edge_filter({weight > 1}) as p
      return p{*}
      

      A --3--> E
      

      边属性大小递增、递减

      本例查找从A到E的1~3步路径,要求只经过@default边且边上的weight属性值递增,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(:3)
        .path_ascend(@default.weight) as p
      return p{*}
      

      A --3--> E
      A --1--> C <--4-- D <--5-- E
      

      边属性@default.weight需LTE。

      本例查找从A到E的1~3步路径,要求只经过@default边且边上的weight属性值递减,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(:3)
        .path_descend(@default.weight) as p
      return p{*}
      

      A --3--> E
      A <--6-- B <--2-- E
      

      边属性@default.weight需LTE。

      规定边方向

      本例查找从A到E的1~3步路径,要求路径中所有边方向朝右,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(:3)
        .direction(right) as p
      return p{*}
      

      A --3--> E
      

      本例查找从A到E的1~3步路径,要求路径中所有边方向朝左,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(:3)
        .direction(left) as p
      return p{*}
      

      A <--6-- B <--2-- E
      

      剔除带有环路的路径

      本例查找从A到C的4步路径,剔除带环路的路径,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "C"}).depth(4).no_circle() as p
      return p{*}
      

      A <--6-- B <--2-- E --3--> D --4--> C
      

      如果没有使用no_circle()参数,返回结果中包括带有环路的路径:

      ab().src({_id == "A"}).dest({_id == "C"}).depth(4) as p
      return p{*}
      

      A --3--> E --2--> B --6--> A --1--> C
      A <--6-- B <--2-- E --3--> D --4--> C
      A <--6-- B <--2-- E <--3-- A --1--> C
      

      限制查询数量

      本例查找1条从A到E的1~3步路径,返回路径中点和边的全部信息:

      ab().src({_id == "A"}).dest({_id == "E"}).depth(:3).limit(1) as p
      return p{*}
      

      A <--6-- B <--2-- E
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写