修改密码

请输入密码
请输入密码 请输入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

搜索

      展开

      概述

      spread().src().depth()子句从一个点进行展开,查询该点K步内的所有边,支持过滤点和边、限制查询的结果数量等。展开子句按照由近到远的顺序返回结果,结果形式为一步路径。

      与K邻查询类似,展开操作按照BFS(广度优先)的方式进行查询,在图计算与分析领域中常用于观察某一个实体周围的层层关系,快速检索并获取数据。

      语法

      • 子句别名:支持,数据类型为PATH
      • 参数:
      参数
      类型 规范
      必须携带
      描述
      参数别名
      src() filter / 路径起点的过滤条件;只能指定一个点,多个点满足条件时会报错 支持,数据类型为NODE
      depth() int >0 展开的最大深度 不支持
      node_filter() filter / 邻居点(非src)的过滤条件 不支持
      edge_filter() filter / 所有边的过滤条件 不支持
      direction() string leftright 路径中所有边的方向 不支持
      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}])
      

      规定展开深度

      本例从点D展开2步,返回找到的一步路径中点和边的全部信息:

      spread().src({_id == "D"}).depth(2) as e
      return e{*}
      

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

      6号边的起点和终点均为点D的2步邻居,因此它也包括在点D的2步展开结果中。

      过滤邻居点

      本例从点D展开2步,要求不经过点E,返回找到的一步路径中点和边的全部信息:

      spread().src({_id == "D"}).depth(2)
        .node_filter({_id != "E"}) as e
      return e{*}
      

      A --1--> C
      D --4--> C
      

      要求不经过点E相当于将点E及其邻边(2、3、5)也排除,此时6号边就没有出现在返回结果中。

      过滤边

      本例从点D展开2步,要求不包含5号边,返回找到的一步路径中点和边的全部信息:

      spread().src({_id == "D"}).depth(2)
        .edge_filter({_uuid != 5}) as e
      return e{*}
      

      A --1--> C
      D --4--> C
      

      排除5号边后,点B和E是点D的3步邻居,因此2号、3号和6号边均没有出现在返回结果中。

      规定边方向

      本例从点D展开2步,要求边的方向为右,返回找到的一步路径中点和边的全部信息:

      spread().src({_id == "D"}).depth(2)
        .direction(right) as e
      return e{*}
      

      D --4--> C
      

      仅考虑出边时,2步内点D只有一个1步邻居点C,因此结果只包含4号边。

      本例从点D展开2步,要求边的方向为左,返回找到的一步路径中点和边的全部信息:

      spread().src({_id == "D"}).depth(2)
        .direction(left) as e
      return e{*}
      

      E --5--> D
      A --3--> E
      

      仅考虑入边时,2步内点D只有1步邻居点E和2步邻居点A,因此结果只包含3号边和5号边。

      限制查询数量

      本例从点D展开3步,返回找到的一步路径中点和边的全部信息:

      spread().src({_id == "D"}).depth(3).limit(3) as e
      return e{*}
      

      E --5--> D
      A --3--> E
      D --4--> C
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写